From d5b775d8876204e623d0912e31e563b95811f46a Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Thu, 27 Feb 2025 03:36:27 +0000 Subject: [PATCH] CodeGen from PR 32874 in Azure/azure-rest-api-specs Merge f22cce0b4b8e0e213e33c4a5c8afd6b3321ad6e8 into 1f5473ea83a9d4ff99230094769a38f70a87bcbb --- .../Sample_AutoUpgradeProfileCollection.cs | 200 ++ .../Sample_AutoUpgradeProfileResource.cs | 113 + .../Samples/Sample_FleetCollection.cs | 208 ++ .../Samples/Sample_FleetMemberCollection.cs | 203 ++ .../Samples/Sample_FleetMemberResource.cs | 113 + .../Generated/Samples/Sample_FleetResource.cs | 141 + .../Sample_FleetUpdateStrategyCollection.cs | 204 ++ .../Sample_FleetUpdateStrategyResource.cs | 117 + .../Sample_SubscriptionResourceExtensions.cs | 97 +- .../Samples/Sample_UpdateRunCollection.cs | 212 ++ .../Samples/Sample_UpdateRunResource.cs | 226 ++ .../Generated/AgentPoolSnapshotCollection.cs | 498 --- .../AgentPoolSnapshotData.Serialization.cs | 567 ---- .../src/Generated/AgentPoolSnapshotData.cs | 131 - ...AgentPoolSnapshotResource.Serialization.cs | 26 - .../Generated/AgentPoolSnapshotResource.cs | 703 ---- .../Generated/AgentPoolUpgradeProfileData.cs | 104 - ...oolUpgradeProfileResource.Serialization.cs | 26 - .../AgentPoolUpgradeProfileResource.cs | 171 - .../ArmContainerServiceModelFactory.cs | 1026 ++---- .../Generated/AutoUpgradeProfileCollection.cs | 497 +++ ...> AutoUpgradeProfileData.Serialization.cs} | 238 +- .../src/Generated/AutoUpgradeProfileData.cs | 121 + ...utoUpgradeProfileResource.Serialization.cs | 26 + ...ource.cs => AutoUpgradeProfileResource.cs} | 166 +- .../ContainerServiceAgentPoolCollection.cs | 493 --- ...ainerServiceAgentPoolData.Serialization.cs | 1725 ---------- .../ContainerServiceAgentPoolData.cs | 314 -- ...rServiceAgentPoolResource.Serialization.cs | 26 - .../ContainerServiceAgentPoolResource.cs | 859 ----- ...rviceMaintenanceConfigurationCollection.cs | 497 --- ...inerServiceMaintenanceConfigurationData.cs | 88 - ...anceConfigurationResource.Serialization.cs | 26 - ...ontainerServiceManagedClusterCollection.cs | 494 --- ...ServiceManagedClusterData.Serialization.cs | 1734 ---------- .../ContainerServiceManagedClusterData.cs | 324 -- ...iceManagedClusterResource.Serialization.cs | 26 - .../ContainerServiceManagedClusterResource.cs | 2330 ------------- ...vicePrivateEndpointConnectionCollection.cs | 495 --- ...nerServicePrivateEndpointConnectionData.cs | 99 - ...ndpointConnectionResource.Serialization.cs | 26 - ...rviceTrustedAccessRoleBindingCollection.cs | 493 --- ...inerServiceTrustedAccessRoleBindingData.cs | 100 - ...AccessRoleBindingResource.Serialization.cs | 26 - .../Extensions/ContainerServiceExtensions.cs | 656 +--- .../MockableContainerServiceArmClient.cs | 132 +- ...leContainerServiceResourceGroupResource.cs | 117 +- ...bleContainerServiceSubscriptionResource.cs | 319 +- .../src/Generated/FleetCollection.cs | 498 +++ ...lization.cs => FleetData.Serialization.cs} | 189 +- .../src/Generated/FleetData.cs | 104 + .../src/Generated/FleetMemberCollection.cs | 497 +++ ...on.cs => FleetMemberData.Serialization.cs} | 254 +- .../src/Generated/FleetMemberData.cs | 102 + .../FleetMemberResource.Serialization.cs | 26 + ...tionResource.cs => FleetMemberResource.cs} | 181 +- .../Generated/FleetResource.Serialization.cs | 26 + .../src/Generated/FleetResource.cs | 1063 ++++++ .../FleetUpdateStrategyCollection.cs | 497 +++ ... FleetUpdateStrategyData.Serialization.cs} | 133 +- .../src/Generated/FleetUpdateStrategyData.cs | 92 + ...eetUpdateStrategyResource.Serialization.cs | 26 + ...urce.cs => FleetUpdateStrategyResource.cs} | 170 +- .../AutoUpgradeProfileOperationSource.cs | 38 + ...ontainerServiceAgentPoolOperationSource.cs | 38 - ...nerServiceManagedClusterOperationSource.cs | 38 - ...TrustedAccessRoleBindingOperationSource.cs | 38 - .../FleetMemberOperationSource.cs | 38 + .../FleetOperationSource.cs | 38 + .../FleetUpdateStrategyOperationSource.cs | 38 + ...dClusterRunCommandResultOperationSource.cs | 30 - .../UpdateRunOperationSource.cs | 38 + ...ClusterUpgradeProfileData.Serialization.cs | 295 -- .../ManagedClusterUpgradeProfileData.cs | 95 - ...terUpgradeProfileResource.Serialization.cs | 26 - .../ManagedClusterUpgradeProfileResource.cs | 170 - .../MeshRevisionProfileCollection.cs | 399 --- .../MeshRevisionProfileData.Serialization.cs | 244 -- .../src/Generated/MeshRevisionProfileData.cs | 86 - ...shRevisionProfileResource.Serialization.cs | 26 - .../Generated/MeshRevisionProfileResource.cs | 171 - .../Generated/MeshUpgradeProfileCollection.cs | 395 --- .../MeshUpgradeProfileData.Serialization.cs | 241 -- .../src/Generated/MeshUpgradeProfileData.cs | 76 - ...eshUpgradeProfileResource.Serialization.cs | 26 - .../Generated/MeshUpgradeProfileResource.cs | 171 - .../Models/AgentPoolAvailableVersion.cs | 76 - ...gentPoolAvailableVersions.Serialization.cs | 277 -- .../src/Generated/Models/AgentPoolMode.cs | 51 - .../Models/AgentPoolNetworkPortProtocol.cs | 51 - ...AgentPoolNetworkPortRange.Serialization.cs | 226 -- .../Models/AgentPoolNetworkPortRange.cs | 76 - .../AgentPoolNetworkProfile.Serialization.cs | 298 -- .../Models/AgentPoolNetworkProfile.cs | 80 - .../src/Generated/Models/AgentPoolType.cs | 51 - ...ilePropertiesUpgradesItem.Serialization.cs | 201 -- .../Models/AgentPoolUpgradeSettings.cs | 71 - ...ation.cs => AgentProfile.Serialization.cs} | 104 +- ...lSnapshotListResult.cs => AgentProfile.cs} | 32 +- ...> ApiServerAccessProfile.Serialization.cs} | 118 +- ...eVersions.cs => ApiServerAccessProfile.cs} | 38 +- .../src/Generated/Models/AutoScaleExpander.cs | 57 - ...pgradeNodeImageSelection.Serialization.cs} | 57 +- ...em.cs => AutoUpgradeNodeImageSelection.cs} | 34 +- .../AutoUpgradeNodeImageSelectionType.cs | 51 + ...UpgradeProfileListResult.Serialization.cs} | 66 +- ...ult.cs => AutoUpgradeProfileListResult.cs} | 30 +- .../AutoUpgradeProfileProvisioningState.cs | 54 + .../ClusterUpgradeSettings.Serialization.cs | 166 - ...erviceAgentPoolListResult.Serialization.cs | 219 -- .../ContainerServiceAgentPoolListResult.cs | 70 - ...tainerServiceCreationData.Serialization.cs | 166 - .../Models/ContainerServiceCreationData.cs | 67 - .../ContainerServiceDateSpan.Serialization.cs | 178 - .../Models/ContainerServiceDateSpan.cs | 80 - ...ServiceEndpointDependency.Serialization.cs | 219 -- .../ContainerServiceEndpointDependency.cs | 72 - .../Models/ContainerServiceEndpointDetail.cs | 82 - .../ContainerServiceIPTag.Serialization.cs | 204 -- .../Generated/Models/ContainerServiceIPTag.cs | 71 - ...tainerServiceLinuxProfile.Serialization.cs | 193 -- .../Models/ContainerServiceLinuxProfile.cs | 90 - .../Models/ContainerServiceLoadBalancerSku.cs | 51 - ...ceAbsoluteMonthlySchedule.Serialization.cs | 176 - ...rviceMaintenanceAbsoluteMonthlySchedule.cs | 80 - ...ceConfigurationListResult.Serialization.cs | 219 -- ...ceRelativeMonthlySchedule.Serialization.cs | 196 -- ...rviceMaintenanceRelativeMonthlySchedule.cs | 87 - ...tenanceRelativeMonthlyScheduleWeekIndex.cs | 60 - ...erviceMaintenanceSchedule.Serialization.cs | 259 -- .../ContainerServiceMaintenanceSchedule.cs | 91 - ...MaintenanceWeeklySchedule.Serialization.cs | 176 - ...ntainerServiceMaintenanceWeeklySchedule.cs | 80 - ...rServiceMaintenanceWindow.Serialization.cs | 334 -- .../ContainerServiceMaintenanceWindow.cs | 107 - .../Models/ContainerServiceNetworkMode.cs | 51 - .../Models/ContainerServiceNetworkPlugin.cs | 54 - .../ContainerServiceNetworkPluginMode.cs | 48 - .../Models/ContainerServiceNetworkPolicy.cs | 54 - ...inerServiceNetworkProfile.Serialization.cs | 695 ---- .../Models/ContainerServiceNetworkProfile.cs | 139 - .../Models/ContainerServiceOSDiskType.cs | 51 - ...erServiceOSOptionProperty.Serialization.cs | 188 -- .../ContainerServiceOSOptionProperty.cs | 83 - .../Generated/Models/ContainerServiceOSSku.cs | 60 - .../Models/ContainerServiceOSType.cs | 51 - ...ainerServiceOutboundEnvironmentEndpoint.cs | 72 - .../Models/ContainerServiceOutboundType.cs | 57 - ...ontainerServicePowerState.Serialization.cs | 166 - ...pointConnectionListResult.Serialization.cs | 185 -- ...vateEndpointConnectionProvisioningState.cs | 60 - ...cePrivateLinkResourceData.Serialization.cs | 348 -- ...ContainerServicePrivateLinkResourceData.cs | 93 - ...teLinkResourcesListResult.Serialization.cs | 185 -- ...erServicePrivateLinkResourcesListResult.cs | 67 - ...inkServiceConnectionState.Serialization.cs | 200 -- ...rvicePrivateLinkServiceConnectionStatus.cs | 57 - .../ContainerServicePublicNetworkAccess.cs | 51 - .../Models/ContainerServiceStateCode.cs | 51 - ...ontainerServiceTimeInWeek.Serialization.cs | 215 -- .../Models/ContainerServiceTimeInWeek.cs | 72 - ...ustedAccessRoleBindingProvisioningState.cs | 60 - ...viceTrustedAccessRoleRule.Serialization.cs | 448 --- .../ContainerServiceTrustedAccessRoleRule.cs | 91 - ...rviceUserAssignedIdentity.Serialization.cs | 226 -- .../ContainerServiceUserAssignedIdentity.cs | 77 - .../Models/ContainerServiceWeekDay.cs | 66 - .../src/Generated/Models/DailySchedule.cs | 73 - ...=> FleetCredentialResult.Serialization.cs} | 38 +- ...Credential.cs => FleetCredentialResult.cs} | 12 +- ...> FleetCredentialResults.Serialization.cs} | 44 +- ...edentials.cs => FleetCredentialResults.cs} | 20 +- .../Models/FleetHubProfile.Serialization.cs | 339 ++ .../src/Generated/Models/FleetHubProfile.cs | 91 + ...on.cs => FleetListResult.Serialization.cs} | 83 +- ...gradeProfileList.cs => FleetListResult.cs} | 36 +- ...=> FleetMemberListResult.Serialization.cs} | 83 +- ...ListResult.cs => FleetMemberListResult.cs} | 36 +- .../Models/FleetMemberPatch.Serialization.cs | 170 + ...ctionListResult.cs => FleetMemberPatch.cs} | 29 +- .../Models/FleetMemberProvisioningState.cs | 63 + ....cs => FleetMemberStatus.Serialization.cs} | 94 +- ...cIssuerProfile.cs => FleetMemberStatus.cs} | 32 +- ...ization.cs => FleetPatch.Serialization.cs} | 54 +- ...inerServiceTagsObject.cs => FleetPatch.cs} | 18 +- .../Models/FleetProvisioningState.cs | 63 + ...zation.cs => FleetStatus.Serialization.cs} | 96 +- ...ityProvisioningError.cs => FleetStatus.cs} | 27 +- ...UpdateStrategyListResult.Serialization.cs} | 83 +- ...on.cs => FleetUpdateStrategyListResult.cs} | 37 +- .../FleetUpdateStrategyProvisioningState.cs | 54 + .../Generated/Models/GpuInstanceProfile.cs | 60 - .../src/Generated/Models/IPFamily.cs | 51 - ...IstioCertificateAuthority.Serialization.cs | 166 - .../Models/IstioCertificateAuthority.cs | 66 - .../src/Generated/Models/IstioComponents.cs | 73 - .../IstioEgressGateway.Serialization.cs | 221 -- .../Generated/Models/IstioEgressGateway.cs | 79 - .../IstioIngressGateway.Serialization.cs | 177 - .../Generated/Models/IstioIngressGateway.cs | 80 - .../Models/IstioIngressGatewayMode.cs | 51 - ...luginCertificateAuthority.Serialization.cs | 308 -- .../Models/IstioPluginCertificateAuthority.cs | 87 - .../Models/IstioServiceMesh.Serialization.cs | 261 -- .../src/Generated/Models/IstioServiceMesh.cs | 89 - .../src/Generated/Models/KubeConfigFormat.cs | 51 - .../Models/KubeletConfig.Serialization.cs | 524 --- .../src/Generated/Models/KubeletConfig.cs | 117 - .../src/Generated/Models/KubeletDiskType.cs | 51 - .../KubernetesPatchVersion.Serialization.cs | 198 -- .../Models/KubernetesPatchVersion.cs | 67 - .../Generated/Models/KubernetesSupportPlan.cs | 51 - .../Models/KubernetesVersion.Serialization.cs | 285 -- .../src/Generated/Models/KubernetesVersion.cs | 88 - ...rnetesVersionCapabilities.Serialization.cs | 185 -- .../Models/KubernetesVersionCapabilities.cs | 67 - ...bernetesVersionListResult.Serialization.cs | 185 -- .../Models/LinuxOSConfig.Serialization.cs | 264 -- .../src/Generated/Models/LinuxOSConfig.cs | 81 - .../ManagedClusterAadProfile.Serialization.cs | 379 --- .../Models/ManagedClusterAadProfile.cs | 97 - .../Models/ManagedClusterAccessProfile.cs | 80 - ...anagedClusterAddonProfile.Serialization.cs | 251 -- .../Models/ManagedClusterAddonProfile.cs | 84 - ...usterAddonProfileIdentity.Serialization.cs | 197 -- .../ManagedClusterAddonProfileIdentity.cs | 31 - ...edClusterAgentPoolProfile.Serialization.cs | 1411 -------- .../Models/ManagedClusterAgentPoolProfile.cs | 87 - ...gentPoolProfileProperties.Serialization.cs | 1630 --------- ...anagedClusterAgentPoolProfileProperties.cs | 305 -- ...terApiServerAccessProfile.Serialization.cs | 331 -- .../ManagedClusterApiServerAccessProfile.cs | 87 - ...dClusterAutoScalerProfile.Serialization.cs | 728 ---- .../Models/ManagedClusterAutoScalerProfile.cs | 146 - ...ClusterAutoUpgradeProfile.Serialization.cs | 196 -- .../ManagedClusterAutoUpgradeProfile.cs | 71 - ...lusterAzureMonitorProfile.Serialization.cs | 166 - .../ManagedClusterAzureMonitorProfile.cs | 66 - .../Models/ManagedClusterDelegatedIdentity.cs | 82 - ...gedClusterHttpProxyConfig.Serialization.cs | 300 -- .../Models/ManagedClusterHttpProxyConfig.cs | 82 - ...ManagedClusterKeyVaultNetworkAccessType.cs | 51 - .../ManagedClusterListResult.Serialization.cs | 219 -- .../Models/ManagedClusterListResult.cs | 70 - ...nagedClusterLoadBalancerBackendPoolType.cs | 51 - ...lusterLoadBalancerProfile.Serialization.cs | 412 --- .../ManagedClusterLoadBalancerProfile.cs | 125 - ...ProfileManagedOutboundIPs.Serialization.cs | 196 -- ...erLoadBalancerProfileManagedOutboundIPs.cs | 71 - ...ProfileOutboundIPPrefixes.Serialization.cs | 186 -- ...erLoadBalancerProfileOutboundIPPrefixes.cs | 68 - ...alancerProfileOutboundIPs.Serialization.cs | 186 -- ...edClusterLoadBalancerProfileOutboundIPs.cs | 68 - ...rManagedOutboundIPProfile.Serialization.cs | 166 - .../ManagedClusterManagedOutboundIPProfile.cs | 66 - ...orProfileKubeStateMetrics.Serialization.cs | 204 -- ...edClusterMonitorProfileKubeStateMetrics.cs | 71 - ...sterMonitorProfileMetrics.Serialization.cs | 187 -- .../ManagedClusterMonitorProfileMetrics.cs | 78 - ...dClusterNatGatewayProfile.Serialization.cs | 249 -- .../Models/ManagedClusterNatGatewayProfile.cs | 90 - .../ManagedClusterNodeOSUpgradeChannel.cs | 54 - ...dClusterOidcIssuerProfile.Serialization.cs | 201 -- .../Models/ManagedClusterPodIdentity.cs | 112 - ...usterPodIdentityException.Serialization.cs | 255 -- .../ManagedClusterPodIdentityException.cs | 92 - ...ClusterPodIdentityProfile.Serialization.cs | 295 -- .../ManagedClusterPodIdentityProfile.cs | 83 - ...IdentityProvisioningError.Serialization.cs | 166 - ...dIdentityProvisioningInfo.Serialization.cs | 169 - ...nagedClusterPodIdentityProvisioningInfo.cs | 71 - ...agedClusterPodIdentityProvisioningState.cs | 63 - .../ManagedClusterPoolUpgradeProfile.cs | 94 - .../Models/ManagedClusterRunCommandContent.cs | 86 - ...edClusterRunCommandResult.Serialization.cs | 390 --- .../Models/ManagedClusterRunCommandResult.cs | 96 - ...gedClusterSecurityProfile.Serialization.cs | 259 -- .../Models/ManagedClusterSecurityProfile.cs | 93 - ...erSecurityProfileDefender.Serialization.cs | 199 -- .../ManagedClusterSecurityProfileDefender.cs | 83 - ...efenderSecurityMonitoring.Serialization.cs | 167 - ...curityProfileDefenderSecurityMonitoring.cs | 66 - ...curityProfileImageCleaner.Serialization.cs | 197 -- ...nagedClusterSecurityProfileImageCleaner.cs | 71 - ...ecurityProfileKeyVaultKms.Serialization.cs | 261 -- ...anagedClusterSecurityProfileKeyVaultKms.cs | 82 - ...tyProfileWorkloadIdentity.Serialization.cs | 167 - ...dClusterSecurityProfileWorkloadIdentity.cs | 66 - ...erServicePrincipalProfile.Serialization.cs | 201 -- .../Generated/Models/ManagedClusterSkuName.cs | 48 - .../Generated/Models/ManagedClusterSkuTier.cs | 54 - ...agedClusterStorageProfile.Serialization.cs | 268 -- .../Models/ManagedClusterStorageProfile.cs | 80 - ...orageProfileBlobCsiDriver.Serialization.cs | 167 - ...nagedClusterStorageProfileBlobCsiDriver.cs | 66 - ...orageProfileDiskCsiDriver.Serialization.cs | 167 - ...nagedClusterStorageProfileDiskCsiDriver.cs | 66 - ...orageProfileFileCsiDriver.Serialization.cs | 167 - ...nagedClusterStorageProfileFileCsiDriver.cs | 66 - ...ProfileSnapshotController.Serialization.cs | 167 - ...ClusterStorageProfileSnapshotController.cs | 66 - ... => ManagedClusterUpdate.Serialization.cs} | 81 +- ...ipalProfile.cs => ManagedClusterUpdate.cs} | 44 +- ...anagedClusterUpgradeSpec.Serialization.cs} | 87 +- ...esItem.cs => ManagedClusterUpgradeSpec.cs} | 35 +- .../Models/ManagedClusterUpgradeType.cs | 54 + .../ManagedClusterVerticalPodAutoscaler.cs | 73 - ...agedClusterWindowsProfile.Serialization.cs | 298 -- .../Models/ManagedClusterWindowsProfile.cs | 96 - ...WorkloadAutoScalerProfile.Serialization.cs | 202 -- ...ManagedClusterWorkloadAutoScalerProfile.cs | 90 - ...loadAutoScalerProfileKeda.Serialization.cs | 157 - ...gedClusterWorkloadAutoScalerProfileKeda.cs | 73 - ...> ManagedServiceIdentity.Serialization.cs} | 138 +- .../Models/ManagedServiceIdentity.cs | 90 + .../Models/ManagedServiceIdentityType.cs | 57 + ...cs => MemberUpdateStatus.Serialization.cs} | 229 +- ...gedClusterSku.cs => MemberUpdateStatus.cs} | 44 +- .../Models/MeshRevision.Serialization.cs | 280 -- .../src/Generated/Models/MeshRevision.cs | 78 - .../Models/MeshRevisionProfileList.cs | 70 - .../Models/MeshRevisionProfileProperties.cs | 67 - ...hUpgradeProfileProperties.Serialization.cs | 241 -- .../Models/MeshUpgradeProfileProperties.cs | 30 - .../src/Generated/Models/NetworkDataplane.cs | 51 - ...cs => NodeImageSelection.Serialization.cs} | 115 +- .../Generated/Models/NodeImageSelection.cs | 79 + ...NodeImageSelectionStatus.Serialization.cs} | 68 +- ...tResult.cs => NodeImageSelectionStatus.cs} | 24 +- .../Models/NodeImageSelectionType.cs | 54 + ...n.cs => NodeImageVersion.Serialization.cs} | 65 +- ...UpgradeSettings.cs => NodeImageVersion.cs} | 22 +- .../src/Generated/Models/ScaleDownMode.cs | 51 - .../Models/ScaleSetEvictionPolicy.cs | 51 - .../src/Generated/Models/ScaleSetPriority.cs | 51 - .../src/Generated/Models/ServiceMeshMode.cs | 51 - .../Models/SkipProperties.Serialization.cs | 136 + ...erviceMeshProfile.cs => SkipProperties.cs} | 39 +- ...ization.cs => SkipTarget.Serialization.cs} | 72 +- ...viceTrustedAccessRole.cs => SkipTarget.cs} | 56 +- .../src/Generated/Models/SnapshotType.cs | 48 - .../Models/SysctlConfig.Serialization.cs | 1010 ------ .../src/Generated/Models/SysctlConfig.cs | 201 -- .../src/Generated/Models/TargetType.cs | 57 + ...cessRoleBindingListResult.Serialization.cs | 219 -- ...ustedAccessRoleListResult.Serialization.cs | 219 -- .../Models/TrustedAccessRoleListResult.cs | 70 - ...zation.cs => UpdateGroup.Serialization.cs} | 67 +- .../{CompatibleVersions.cs => UpdateGroup.cs} | 41 +- ....cs => UpdateGroupStatus.Serialization.cs} | 102 +- ...onnectionState.cs => UpdateGroupStatus.cs} | 34 +- .../UpdateRunListResult.Serialization.cs | 208 ++ ...onListResult.cs => UpdateRunListResult.cs} | 36 +- .../Models/UpdateRunProvisioningState.cs | 54 + ...on.cs => UpdateRunStatus.Serialization.cs} | 141 +- .../src/Generated/Models/UpdateRunStatus.cs | 82 + ....cs => UpdateRunStrategy.Serialization.cs} | 66 +- ...ceSshPublicKey.cs => UpdateRunStrategy.cs} | 43 +- ...zation.cs => UpdateStage.Serialization.cs} | 125 +- .../src/Generated/Models/UpdateStage.cs | 87 + ....cs => UpdateStageStatus.Serialization.cs} | 151 +- ...errideSettings.cs => UpdateStageStatus.cs} | 43 +- .../src/Generated/Models/UpdateState.cs | 66 + ...ation.cs => UpdateStatus.Serialization.cs} | 153 +- ...inerServiceTimeSpan.cs => UpdateStatus.cs} | 40 +- .../src/Generated/Models/UpgradeChannel.cs | 25 +- ...ization.cs => WaitStatus.Serialization.cs} | 84 +- ...inerServicePowerState.cs => WaitStatus.cs} | 27 +- .../WindowsGmsaProfile.Serialization.cs | 235 -- .../Generated/Models/WindowsGmsaProfile.cs | 76 - .../Generated/Models/WindowsVmLicenseType.cs | 51 - .../src/Generated/Models/WorkloadRuntime.cs | 51 - .../OSOptionProfileData.Serialization.cs | 271 -- .../src/Generated/OSOptionProfileData.cs | 87 - .../OSOptionProfileResource.Serialization.cs | 26 - .../src/Generated/OSOptionProfileResource.cs | 172 - ...s => AutoUpgradeProfilesRestOperations.cs} | 340 +- .../FleetMembersRestOperations.cs | 639 ++++ ...=> FleetUpdateStrategiesRestOperations.cs} | 324 +- ...tOperations.cs => FleetsRestOperations.cs} | 464 ++- .../ManagedClustersRestOperations.cs | 2957 ----------------- ...rivateEndpointConnectionsRestOperations.cs | 439 --- .../PrivateLinkResourcesRestOperations.cs | 133 - ...solvePrivateLinkServiceIdRestOperations.cs | 141 - .../TrustedAccessRolesRestOperations.cs | 201 -- ...rations.cs => UpdateRunsRestOperations.cs} | 668 ++-- .../src/Generated/UpdateRunCollection.cs | 497 +++ ...tion.cs => UpdateRunData.Serialization.cs} | 222 +- .../src/Generated/UpdateRunData.cs | 142 + .../UpdateRunResource.Serialization.cs | 26 + .../src/Generated/UpdateRunResource.cs | 620 ++++ .../src/autorest.md | 2 +- sdk/resourcemanager/ci.mgmt.yml | 4 +- 393 files changed, 13436 insertions(+), 57609 deletions(-) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunCollection.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServiceMaintenanceConfigurationData.Serialization.cs => AutoUpgradeProfileData.Serialization.cs} (54%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServiceTrustedAccessRoleBindingResource.cs => AutoUpgradeProfileResource.cs} (53%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{Models/ManagedClusterAccessProfile.Serialization.cs => FleetData.Serialization.cs} (58%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{AgentPoolUpgradeProfileData.Serialization.cs => FleetMemberData.Serialization.cs} (51%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServiceMaintenanceConfigurationResource.cs => FleetMemberResource.cs} (50%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServicePrivateEndpointConnectionData.Serialization.cs => FleetUpdateStrategyData.Serialization.cs} (65%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServicePrivateEndpointConnectionResource.cs => FleetUpdateStrategyResource.cs} (52%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/AutoUpgradeProfileOperationSource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceAgentPoolOperationSource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceManagedClusterOperationSource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceTrustedAccessRoleBindingOperationSource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetMemberOperationSource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetOperationSource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetUpdateStrategyOperationSource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ManagedClusterRunCommandResultOperationSource.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/UpdateRunOperationSource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortProtocol.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolUpgradeSettings.Serialization.cs => AgentProfile.Serialization.cs} (60%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolSnapshotListResult.cs => AgentProfile.cs} (64%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolAvailableVersion.Serialization.cs => ApiServerAccessProfile.Serialization.cs} (56%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolAvailableVersions.cs => ApiServerAccessProfile.cs} (55%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoScaleExpander.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterVerticalPodAutoscaler.Serialization.cs => AutoUpgradeNodeImageSelection.Serialization.cs} (60%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolUpgradeProfilePropertiesUpgradesItem.cs => AutoUpgradeNodeImageSelection.cs} (64%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelectionType.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{OutboundEnvironmentEndpointListResult.Serialization.cs => AutoUpgradeProfileListResult.Serialization.cs} (65%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{OutboundEnvironmentEndpointListResult.cs => AutoUpgradeProfileListResult.cs} (61%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileProvisioningState.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterUpgradeSettings.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLoadBalancerSku.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkMode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSDiskType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionProvisioningState.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionStatus.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceStateCode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingProvisioningState.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceWeekDay.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterCredential.Serialization.cs => FleetCredentialResult.Serialization.cs} (75%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterCredential.cs => FleetCredentialResult.cs} (82%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterCredentials.Serialization.cs => FleetCredentialResults.Serialization.cs} (70%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterCredentials.cs => FleetCredentialResults.cs} (69%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{MeshUpgradeProfileList.Serialization.cs => FleetListResult.Serialization.cs} (65%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{MeshUpgradeProfileList.cs => FleetListResult.cs} (60%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{AgentPoolSnapshotListResult.Serialization.cs => FleetMemberListResult.Serialization.cs} (64%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{TrustedAccessRoleBindingListResult.cs => FleetMemberListResult.cs} (57%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServicePrivateEndpointConnectionListResult.cs => FleetMemberPatch.cs} (61%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterSku.Serialization.cs => FleetMemberStatus.Serialization.cs} (61%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterOidcIssuerProfile.cs => FleetMemberStatus.cs} (62%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTagsObject.Serialization.cs => FleetPatch.Serialization.cs} (63%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTagsObject.cs => FleetPatch.cs} (73%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetProvisioningState.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{UpgradeOverrideSettings.Serialization.cs => FleetStatus.Serialization.cs} (58%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterPodIdentityProvisioningError.cs => FleetStatus.cs} (64%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{MeshRevisionProfileList.Serialization.cs => FleetUpdateStrategyListResult.Serialization.cs} (64%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceSshConfiguration.cs => FleetUpdateStrategyListResult.cs} (56%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyProvisioningState.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuInstanceProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGatewayMode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeConfigFormat.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletDiskType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesSupportPlan.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterKeyVaultNetworkAccessType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerBackendPoolType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningState.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuTier.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ServiceMeshProfile.Serialization.cs => ManagedClusterUpdate.Serialization.cs} (58%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterServicePrincipalProfile.cs => ManagedClusterUpdate.cs} (59%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs => ManagedClusterUpgradeSpec.Serialization.cs} (63%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterPoolUpgradeProfileUpgradesItem.cs => ManagedClusterUpgradeSpec.cs} (61%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterDelegatedIdentity.Serialization.cs => ManagedServiceIdentity.Serialization.cs} (56%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentityType.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterPodIdentity.Serialization.cs => MemberUpdateStatus.Serialization.cs} (52%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterSku.cs => MemberUpdateStatus.cs} (52%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkDataplane.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{CompatibleVersions.Serialization.cs => NodeImageSelection.Serialization.cs} (60%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{MeshRevisionProfileProperties.Serialization.cs => NodeImageSelectionStatus.Serialization.cs} (61%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{KubernetesVersionListResult.cs => NodeImageSelectionStatus.cs} (65%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionType.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceSshPublicKey.Serialization.cs => NodeImageVersion.Serialization.cs} (62%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ClusterUpgradeSettings.cs => NodeImageVersion.cs} (69%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleDownMode.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetPriority.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshMode.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ServiceMeshProfile.cs => SkipProperties.cs} (66%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterRunCommandContent.Serialization.cs => SkipTarget.Serialization.cs} (50%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTrustedAccessRole.cs => SkipTarget.cs} (51%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TargetType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{DailySchedule.Serialization.cs => UpdateGroup.Serialization.cs} (62%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{CompatibleVersions.cs => UpdateGroup.cs} (61%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTrustedAccessRole.Serialization.cs => UpdateGroupStatus.Serialization.cs} (61%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServicePrivateLinkServiceConnectionState.cs => UpdateGroupStatus.cs} (60%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.Serialization.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceMaintenanceConfigurationListResult.cs => UpdateRunListResult.cs} (58%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunProvisioningState.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{IstioComponents.Serialization.cs => UpdateRunStatus.Serialization.cs} (56%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceSshConfiguration.Serialization.cs => UpdateRunStrategy.Serialization.cs} (60%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceSshPublicKey.cs => UpdateRunStrategy.cs} (57%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs => UpdateStage.Serialization.cs} (57%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ManagedClusterPoolUpgradeProfile.Serialization.cs => UpdateStageStatus.Serialization.cs} (59%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{UpgradeOverrideSettings.cs => UpdateStageStatus.cs} (53%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateState.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceEndpointDetail.Serialization.cs => UpdateStatus.Serialization.cs} (53%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTimeSpan.cs => UpdateStatus.cs} (54%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServiceTimeSpan.Serialization.cs => WaitStatus.Serialization.cs} (59%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/{ContainerServicePowerState.cs => WaitStatus.cs} (65%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsVmLicenseType.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.Serialization.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/{MaintenanceConfigurationsRestOperations.cs => AutoUpgradeProfilesRestOperations.cs} (56%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/{TrustedAccessRoleBindingsRestOperations.cs => FleetUpdateStrategiesRestOperations.cs} (59%) rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/{SnapshotsRestOperations.cs => FleetsRestOperations.cs} (62%) delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs delete mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/{AgentPoolsRestOperations.cs => UpdateRunsRestOperations.cs} (50%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunCollection.cs rename sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/{ContainerServiceTrustedAccessRoleBindingData.Serialization.cs => UpdateRunData.Serialization.cs} (56%) create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.Serialization.cs create mode 100644 sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.cs diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileCollection.cs new file mode 100644 index 000000000000..39e7ebacea78 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileCollection.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.ContainerService.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_AutoUpgradeProfileCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAnAutoUpgradeProfile() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_CreateOrUpdate.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this AutoUpgradeProfileResource + AutoUpgradeProfileCollection collection = fleet.GetAutoUpgradeProfiles(); + + // invoke the operation + string autoUpgradeProfileName = "autoupgradeprofile1"; + AutoUpgradeProfileData data = new AutoUpgradeProfileData + { + Channel = UpgradeChannel.Stable, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, autoUpgradeProfileName, data); + AutoUpgradeProfileResource 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 + AutoUpgradeProfileData 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_GetsAnAutoUpgradeProfileResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_Get.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this AutoUpgradeProfileResource + AutoUpgradeProfileCollection collection = fleet.GetAutoUpgradeProfiles(); + + // invoke the operation + string autoUpgradeProfileName = "autoupgradeprofile1"; + AutoUpgradeProfileResource result = await collection.GetAsync(autoUpgradeProfileName); + + // 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 + AutoUpgradeProfileData 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_ListsTheAutoUpgradeProfileResourcesByFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_ListByFleet.json + // this example is just showing the usage of "AutoUpgradeProfiles_ListByFleet" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this AutoUpgradeProfileResource + AutoUpgradeProfileCollection collection = fleet.GetAutoUpgradeProfiles(); + + // invoke the operation and iterate over the result + await foreach (AutoUpgradeProfileResource 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 + AutoUpgradeProfileData 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_GetsAnAutoUpgradeProfileResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_Get.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this AutoUpgradeProfileResource + AutoUpgradeProfileCollection collection = fleet.GetAutoUpgradeProfiles(); + + // invoke the operation + string autoUpgradeProfileName = "autoupgradeprofile1"; + bool result = await collection.ExistsAsync(autoUpgradeProfileName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsAnAutoUpgradeProfileResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_Get.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this AutoUpgradeProfileResource + AutoUpgradeProfileCollection collection = fleet.GetAutoUpgradeProfiles(); + + // invoke the operation + string autoUpgradeProfileName = "autoupgradeprofile1"; + NullableResponse response = await collection.GetIfExistsAsync(autoUpgradeProfileName); + AutoUpgradeProfileResource 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 + AutoUpgradeProfileData 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_AutoUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileResource.cs new file mode 100644 index 000000000000..1473fa70e316 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_AutoUpgradeProfileResource.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_AutoUpgradeProfileResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAnAutoUpgradeProfileResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_Get.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 AutoUpgradeProfileResource created on azure + // for more information of creating AutoUpgradeProfileResource, please refer to the document of AutoUpgradeProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string autoUpgradeProfileName = "autoupgradeprofile1"; + ResourceIdentifier autoUpgradeProfileResourceId = AutoUpgradeProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName); + AutoUpgradeProfileResource autoUpgradeProfile = client.GetAutoUpgradeProfileResource(autoUpgradeProfileResourceId); + + // invoke the operation + AutoUpgradeProfileResource result = await autoUpgradeProfile.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 + AutoUpgradeProfileData 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_DeleteAnAutoUpgradeProfileResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_Delete.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 AutoUpgradeProfileResource created on azure + // for more information of creating AutoUpgradeProfileResource, please refer to the document of AutoUpgradeProfileResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string autoUpgradeProfileName = "autoupgradeprofile1"; + ResourceIdentifier autoUpgradeProfileResourceId = AutoUpgradeProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName); + AutoUpgradeProfileResource autoUpgradeProfile = client.GetAutoUpgradeProfileResource(autoUpgradeProfileResourceId); + + // invoke the operation + await autoUpgradeProfile.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAnAutoUpgradeProfile() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/AutoUpgradeProfiles_CreateOrUpdate.json + // this example is just showing the usage of "AutoUpgradeProfiles_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 AutoUpgradeProfileResource created on azure + // for more information of creating AutoUpgradeProfileResource, please refer to the document of AutoUpgradeProfileResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string autoUpgradeProfileName = "autoupgradeprofile1"; + ResourceIdentifier autoUpgradeProfileResourceId = AutoUpgradeProfileResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName); + AutoUpgradeProfileResource autoUpgradeProfile = client.GetAutoUpgradeProfileResource(autoUpgradeProfileResourceId); + + // invoke the operation + AutoUpgradeProfileData data = new AutoUpgradeProfileData + { + Channel = UpgradeChannel.Stable, + }; + ArmOperation lro = await autoUpgradeProfile.UpdateAsync(WaitUntil.Completed, data); + AutoUpgradeProfileResource 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 + AutoUpgradeProfileData 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_FleetCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetCollection.cs new file mode 100644 index 000000000000..20fbe32390c9 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetCollection.cs @@ -0,0 +1,208 @@ +// 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 Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ContainerService.Samples +{ + public partial class Sample_FleetCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreatesAFleetResourceWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_CreateOrUpdate.json + // this example is just showing the usage of "Fleets_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 = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FleetResource + FleetCollection collection = resourceGroupResource.GetFleets(); + + // invoke the operation + string fleetName = "fleet1"; + FleetData data = new FleetData(new AzureLocation("East US")) + { + HubProfile = new FleetHubProfile + { + DnsPrefix = "dnsprefix1", + AgentProfile = new AgentProfile + { + VmSize = "Standard_DS1", + }, + }, + Tags = +{ +["archv2"] = "", +["tier"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fleetName, data); + FleetResource 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 + FleetData 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_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_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 = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FleetResource + FleetCollection collection = resourceGroupResource.GetFleets(); + + // invoke the operation + string fleetName = "fleet1"; + FleetResource result = await collection.GetAsync(fleetName); + + // 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 + FleetData 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_ListsTheFleetResourcesInAResourceGroup() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_ListByResourceGroup.json + // this example is just showing the usage of "Fleets_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 = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FleetResource + FleetCollection collection = resourceGroupResource.GetFleets(); + + // invoke the operation and iterate over the result + await foreach (FleetResource 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 + FleetData 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_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_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 = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FleetResource + FleetCollection collection = resourceGroupResource.GetFleets(); + + // invoke the operation + string fleetName = "fleet1"; + bool result = await collection.ExistsAsync(fleetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_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 = "subid1"; + string resourceGroupName = "rg1"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this FleetResource + FleetCollection collection = resourceGroupResource.GetFleets(); + + // invoke the operation + string fleetName = "fleet1"; + NullableResponse response = await collection.GetIfExistsAsync(fleetName); + FleetResource 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 + FleetData 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_FleetMemberCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberCollection.cs new file mode 100644 index 000000000000..db107707b38e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberCollection.cs @@ -0,0 +1,203 @@ +// 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_FleetMemberCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreatesAFleetMemberResourceWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Create.json + // this example is just showing the usage of "FleetMembers_Create" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetMemberResource + FleetMemberCollection collection = fleet.GetFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + FleetMemberData data = new FleetMemberData + { + ClusterResourceId = new ResourceIdentifier("/subscriptions/subid1/resourcegroups/rg1/providers/Microsoft.ContainerService/managedClusters/cluster-1"), + Labels = +{ +["environment"] = "production" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, fleetMemberName, data); + FleetMemberResource 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 + FleetMemberData 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_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetMemberResource + FleetMemberCollection collection = fleet.GetFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + FleetMemberResource result = await collection.GetAsync(fleetMemberName); + + // 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 + FleetMemberData 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_ListsTheMembersOfAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_ListByFleet.json + // this example is just showing the usage of "FleetMembers_ListByFleet" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetMemberResource + FleetMemberCollection collection = fleet.GetFleetMembers(); + + // invoke the operation and iterate over the result + await foreach (FleetMemberResource 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 + FleetMemberData 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_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetMemberResource + FleetMemberCollection collection = fleet.GetFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + bool result = await collection.ExistsAsync(fleetMemberName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetMemberResource + FleetMemberCollection collection = fleet.GetFleetMembers(); + + // invoke the operation + string fleetMemberName = "member-1"; + NullableResponse response = await collection.GetIfExistsAsync(fleetMemberName); + FleetMemberResource 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 + FleetMemberData 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_FleetMemberResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberResource.cs new file mode 100644 index 000000000000..af8deb380f25 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetMemberResource.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_FleetMemberResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAFleetMemberResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Get.json + // this example is just showing the usage of "FleetMembers_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 FleetMemberResource created on azure + // for more information of creating FleetMemberResource, please refer to the document of FleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier fleetMemberResourceId = FleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + FleetMemberResource fleetMember = client.GetFleetMemberResource(fleetMemberResourceId); + + // invoke the operation + FleetMemberResource result = await fleetMember.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 + FleetMemberData 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_DeletesAFleetMemberResourceAsynchronouslyWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Delete.json + // this example is just showing the usage of "FleetMembers_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 FleetMemberResource created on azure + // for more information of creating FleetMemberResource, please refer to the document of FleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier fleetMemberResourceId = FleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + FleetMemberResource fleetMember = client.GetFleetMemberResource(fleetMemberResourceId); + + // invoke the operation + await fleetMember.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdatesAFleetMemberResourceSynchronously() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/FleetMembers_Update.json + // this example is just showing the usage of "FleetMembers_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 FleetMemberResource created on azure + // for more information of creating FleetMemberResource, please refer to the document of FleetMemberResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string fleetMemberName = "member-1"; + ResourceIdentifier fleetMemberResourceId = FleetMemberResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + FleetMemberResource fleetMember = client.GetFleetMemberResource(fleetMemberResourceId); + + // invoke the operation + FleetMemberPatch patch = new FleetMemberPatch + { + Group = "staging", + }; + ArmOperation lro = await fleetMember.UpdateAsync(WaitUntil.Completed, patch); + FleetMemberResource 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 + FleetMemberData 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_FleetResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetResource.cs new file mode 100644 index 000000000000..639c540c5c17 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetResource.cs @@ -0,0 +1,141 @@ +// 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_FleetResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAFleetResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_Get.json + // this example is just showing the usage of "Fleets_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // invoke the operation + FleetResource result = await fleet.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 + FleetData 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_DeletesAFleetResourceAsynchronouslyWithALongRunningOperation() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_Delete.json + // this example is just showing the usage of "Fleets_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // invoke the operation + await fleet.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_PatchTags.json + // this example is just showing the usage of "Fleets_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // invoke the operation + FleetPatch patch = new FleetPatch + { + Tags = +{ +["env"] = "prod", +["tier"] = "secure" +}, + }; + string ifMatch = "dfjkwelr7384"; + ArmOperation lro = await fleet.UpdateAsync(WaitUntil.Completed, patch, ifMatch: ifMatch); + FleetResource 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 + FleetData 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 GetCredentials_ListsTheUserCredentialsOfAFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_ListCredentialsResult.json + // this example is just showing the usage of "Fleets_ListCredentials" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // invoke the operation + FleetCredentialResults result = await fleet.GetCredentialsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyCollection.cs new file mode 100644 index 000000000000..de7afc926c27 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyCollection.cs @@ -0,0 +1,204 @@ +// 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_FleetUpdateStrategyCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAFleetUpdateStrategy() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_CreateOrUpdate.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetUpdateStrategyResource + FleetUpdateStrategyCollection collection = fleet.GetFleetUpdateStrategies(); + + // invoke the operation + string updateStrategyName = "strartegy1"; + FleetUpdateStrategyData data = new FleetUpdateStrategyData + { + StrategyStages = {new UpdateStage("stage1") +{ +Groups = {new UpdateGroup("group-a")}, +AfterStageWaitInSeconds = 3600, +}}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, updateStrategyName, data); + FleetUpdateStrategyResource 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 + FleetUpdateStrategyData 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_GetAFleetUpdateStrategyResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_Get.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetUpdateStrategyResource + FleetUpdateStrategyCollection collection = fleet.GetFleetUpdateStrategies(); + + // invoke the operation + string updateStrategyName = "strategy1"; + FleetUpdateStrategyResource result = await collection.GetAsync(updateStrategyName); + + // 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 + FleetUpdateStrategyData 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_ListTheFleetUpdateStrategyResourcesByFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_ListByFleet.json + // this example is just showing the usage of "FleetUpdateStrategies_ListByFleet" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetUpdateStrategyResource + FleetUpdateStrategyCollection collection = fleet.GetFleetUpdateStrategies(); + + // invoke the operation and iterate over the result + await foreach (FleetUpdateStrategyResource 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 + FleetUpdateStrategyData 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_GetAFleetUpdateStrategyResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_Get.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetUpdateStrategyResource + FleetUpdateStrategyCollection collection = fleet.GetFleetUpdateStrategies(); + + // invoke the operation + string updateStrategyName = "strategy1"; + bool result = await collection.ExistsAsync(updateStrategyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetAFleetUpdateStrategyResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_Get.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this FleetUpdateStrategyResource + FleetUpdateStrategyCollection collection = fleet.GetFleetUpdateStrategies(); + + // invoke the operation + string updateStrategyName = "strategy1"; + NullableResponse response = await collection.GetIfExistsAsync(updateStrategyName); + FleetUpdateStrategyResource 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 + FleetUpdateStrategyData 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_FleetUpdateStrategyResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyResource.cs new file mode 100644 index 000000000000..48c1f085772f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_FleetUpdateStrategyResource.cs @@ -0,0 +1,117 @@ +// 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_FleetUpdateStrategyResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetAFleetUpdateStrategyResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_Get.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetUpdateStrategyResource created on azure + // for more information of creating FleetUpdateStrategyResource, please refer to the document of FleetUpdateStrategyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateStrategyName = "strategy1"; + ResourceIdentifier fleetUpdateStrategyResourceId = FleetUpdateStrategyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateStrategyName); + FleetUpdateStrategyResource fleetUpdateStrategy = client.GetFleetUpdateStrategyResource(fleetUpdateStrategyResourceId); + + // invoke the operation + FleetUpdateStrategyResource result = await fleetUpdateStrategy.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 + FleetUpdateStrategyData 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_DeleteAFleetUpdateStrategyResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_Delete.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetUpdateStrategyResource created on azure + // for more information of creating FleetUpdateStrategyResource, please refer to the document of FleetUpdateStrategyResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateStrategyName = "strategy1"; + ResourceIdentifier fleetUpdateStrategyResourceId = FleetUpdateStrategyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateStrategyName); + FleetUpdateStrategyResource fleetUpdateStrategy = client.GetFleetUpdateStrategyResource(fleetUpdateStrategyResourceId); + + // invoke the operation + await fleetUpdateStrategy.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAFleetUpdateStrategy() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateStrategies_CreateOrUpdate.json + // this example is just showing the usage of "FleetUpdateStrategies_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 FleetUpdateStrategyResource created on azure + // for more information of creating FleetUpdateStrategyResource, please refer to the document of FleetUpdateStrategyResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateStrategyName = "strartegy1"; + ResourceIdentifier fleetUpdateStrategyResourceId = FleetUpdateStrategyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateStrategyName); + FleetUpdateStrategyResource fleetUpdateStrategy = client.GetFleetUpdateStrategyResource(fleetUpdateStrategyResourceId); + + // invoke the operation + FleetUpdateStrategyData data = new FleetUpdateStrategyData + { + StrategyStages = {new UpdateStage("stage1") +{ +Groups = {new UpdateGroup("group-a")}, +AfterStageWaitInSeconds = 3600, +}}, + }; + ArmOperation lro = await fleetUpdateStrategy.UpdateAsync(WaitUntil.Completed, data); + FleetUpdateStrategyResource 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 + FleetUpdateStrategyData 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..20ca8b8de5e2 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 @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; -using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Resources; using NUnit.Framework; @@ -19,10 +18,10 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() + public async Task GetFleets_ListsTheFleetResourcesInASubscription() { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/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. + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/Fleets_ListBySub.json + // this example is just showing the usage of "Fleets_ListBySubscription" 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(); @@ -31,105 +30,21 @@ public async Task GetKubernetesVersionsManagedCluster_ListKubernetesVersions() // 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 - AzureLocation location = new AzureLocation("location1"); - KubernetesVersionListResult result = await subscriptionResource.GetKubernetesVersionsManagedClusterAsync(location); - - Console.WriteLine($"Succeeded: {result}"); - } - - [Test] - [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 - // 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 - 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"; + string subscriptionId = "subid1"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ContainerServiceManagedClusterResource item in subscriptionResource.GetContainerServiceManagedClustersAsync()) + await foreach (FleetResource item in subscriptionResource.GetFleetsAsync()) { // 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 - ContainerServiceManagedClusterData resourceData = item.Data; + FleetData 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 GetAgentPoolSnapshots_ListSnapshots() - { - // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/aks/stable/2023-10-01/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 - 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 (AgentPoolSnapshotResource item in subscriptionResource.GetAgentPoolSnapshotsAsync()) - { - // 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 - AgentPoolSnapshotData 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 - // 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 - 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("westus2"); - await foreach (ContainerServiceTrustedAccessRole item in subscriptionResource.GetTrustedAccessRolesAsync(location)) - { - Console.WriteLine($"Succeeded: {item}"); - } - - Console.WriteLine("Succeeded"); - } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunCollection.cs new file mode 100644 index 000000000000..9ce443bcae3b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunCollection.cs @@ -0,0 +1,212 @@ +// 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_UpdateRunCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_CreateOrUpdate.json + // this example is just showing the usage of "UpdateRuns_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = fleet.GetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + UpdateRunData data = new UpdateRunData + { + UpdateStrategyId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + StrategyStages = {new UpdateStage("stage1") +{ +Groups = {new UpdateGroup("group-a")}, +AfterStageWaitInSeconds = 3600, +}}, + ManagedClusterUpdate = new ManagedClusterUpdate(new ManagedClusterUpgradeSpec(ManagedClusterUpgradeType.Full) + { + KubernetesVersion = "1.26.1", + }) + { + NodeImageSelection = new NodeImageSelection(NodeImageSelectionType.Latest), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, updateRunName, data); + UpdateRunResource 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 + UpdateRunData 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_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = fleet.GetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + UpdateRunResource result = await collection.GetAsync(updateRunName); + + // 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 + UpdateRunData 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_ListsTheUpdateRunResourcesByFleet() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_ListByFleet.json + // this example is just showing the usage of "UpdateRuns_ListByFleet" 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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = fleet.GetUpdateRuns(); + + // invoke the operation and iterate over the result + await foreach (UpdateRunResource 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 + UpdateRunData 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_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = fleet.GetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + bool result = await collection.ExistsAsync(updateRunName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_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 FleetResource created on azure + // for more information of creating FleetResource, please refer to the document of FleetResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + ResourceIdentifier fleetResourceId = FleetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName); + FleetResource fleet = client.GetFleetResource(fleetResourceId); + + // get the collection of this UpdateRunResource + UpdateRunCollection collection = fleet.GetUpdateRuns(); + + // invoke the operation + string updateRunName = "run1"; + NullableResponse response = await collection.GetIfExistsAsync(updateRunName); + UpdateRunResource 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 + UpdateRunData 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_UpdateRunResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunResource.cs new file mode 100644 index 000000000000..fc088bb2d0d2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/samples/Generated/Samples/Sample_UpdateRunResource.cs @@ -0,0 +1,226 @@ +// 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_UpdateRunResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetsAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Get.json + // this example is just showing the usage of "UpdateRuns_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 UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + UpdateRunResource result = await updateRun.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 + UpdateRunData 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_DeleteAnUpdateRunResource() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Delete.json + // this example is just showing the usage of "UpdateRuns_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 UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "subid1"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + await updateRun.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_CreateOrUpdate.json + // this example is just showing the usage of "UpdateRuns_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 UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + UpdateRunData data = new UpdateRunData + { + UpdateStrategyId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ContainerService/fleets/myFleet/updateStrategies/strategy1"), + StrategyStages = {new UpdateStage("stage1") +{ +Groups = {new UpdateGroup("group-a")}, +AfterStageWaitInSeconds = 3600, +}}, + ManagedClusterUpdate = new ManagedClusterUpdate(new ManagedClusterUpgradeSpec(ManagedClusterUpgradeType.Full) + { + KubernetesVersion = "1.26.1", + }) + { + NodeImageSelection = new NodeImageSelection(NodeImageSelectionType.Latest), + }, + }; + ArmOperation lro = await updateRun.UpdateAsync(WaitUntil.Completed, data); + UpdateRunResource 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 + UpdateRunData 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 Skip_SkipsOneOrMoreMemberGroupStageAfterStageWaitSOfAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Skip.json + // this example is just showing the usage of "UpdateRuns_Skip" 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 UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + SkipProperties body = new SkipProperties(new SkipTarget[] + { +new SkipTarget(TargetType.Member, "member-one"), +new SkipTarget(TargetType.AfterStageWait, "stage1") + }); + ArmOperation lro = await updateRun.SkipAsync(WaitUntil.Completed, body); + UpdateRunResource 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 + UpdateRunData 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 Start_StartsAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Start.json + // this example is just showing the usage of "UpdateRuns_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 + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + ArmOperation lro = await updateRun.StartAsync(WaitUntil.Completed); + UpdateRunResource 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 + UpdateRunData 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 Stop_StopsAnUpdateRun() + { + // Generated from example definition: specification/containerservice/resource-manager/Microsoft.ContainerService/fleet/stable/2025-03-01/examples/UpdateRuns_Stop.json + // this example is just showing the usage of "UpdateRuns_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 + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this UpdateRunResource created on azure + // for more information of creating UpdateRunResource, please refer to the document of UpdateRunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg1"; + string fleetName = "fleet1"; + string updateRunName = "run1"; + ResourceIdentifier updateRunResourceId = UpdateRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, fleetName, updateRunName); + UpdateRunResource updateRun = client.GetUpdateRunResource(updateRunResourceId); + + // invoke the operation + ArmOperation lro = await updateRun.StopAsync(WaitUntil.Completed); + UpdateRunResource 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 + UpdateRunData 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/src/Generated/AgentPoolSnapshotCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs deleted file mode 100644 index 327b8b63ae23..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotCollection.cs +++ /dev/null @@ -1,498 +0,0 @@ -// 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 an instance call the GetAgentPoolSnapshots method from an instance of . - /// - public partial class AgentPoolSnapshotCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; - private readonly SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; - - /// Initializes a new instance of the class for mocking. - protected AgentPoolSnapshotCollection() - { - } - - /// 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 AgentPoolSnapshotCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _agentPoolSnapshotSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", AgentPoolSnapshotResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(AgentPoolSnapshotResource.ResourceType, out string agentPoolSnapshotSnapshotsApiVersion); - _agentPoolSnapshotSnapshotsRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agentPoolSnapshotSnapshotsApiVersion); -#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 snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 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, AgentPoolSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken).ConfigureAwait(false); - var uri = _agentPoolSnapshotSnapshotsRestClient.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 AgentPoolSnapshotResource(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 snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 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, AgentPoolSnapshotData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, resourceName, data, cancellationToken); - var uri = _agentPoolSnapshotSnapshotsRestClient.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 AgentPoolSnapshotResource(Client, response), response.GetRawResponse()), rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.Get"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.Get"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists snapshots in the specified subscription and resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists snapshots in the specified subscription and resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agentPoolSnapshotSnapshotsRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), _agentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "AgentPoolSnapshotCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.Exists"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.Exists"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotCollection.GetIfExists"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(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/AgentPoolSnapshotData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.Serialization.cs deleted file mode 100644 index c99254a7bcde..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.Serialization.cs +++ /dev/null @@ -1,567 +0,0 @@ -// 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 AgentPoolSnapshotData : 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(AgentPoolSnapshotData)} 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(KubernetesVersion)) - { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - } - if (options.Format != "W" && Optional.IsDefined(NodeImageVersion)) - { - writer.WritePropertyName("nodeImageVersion"u8); - writer.WriteStringValue(NodeImageVersion); - } - if (options.Format != "W" && Optional.IsDefined(OSType)) - { - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(OSSku)) - { - writer.WritePropertyName("osSku"u8); - writer.WriteStringValue(OSSku.Value.ToString()); - } - if (options.Format != "W" && Optional.IsDefined(VmSize)) - { - writer.WritePropertyName("vmSize"u8); - writer.WriteStringValue(VmSize); - } - if (options.Format != "W" && Optional.IsDefined(EnableFips)) - { - writer.WritePropertyName("enableFIPS"u8); - writer.WriteBooleanValue(EnableFips.Value); - } - writer.WriteEndObject(); - } - - AgentPoolSnapshotData 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(AgentPoolSnapshotData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolSnapshotData(document.RootElement, options); - } - - internal static AgentPoolSnapshotData DeserializeAgentPoolSnapshotData(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; - string kubernetesVersion = default; - string nodeImageVersion = default; - ContainerServiceOSType? osType = default; - ContainerServiceOSSku? osSku = default; - string vmSize = default; - bool? enableFIPS = 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("kubernetesVersion"u8)) - { - kubernetesVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("nodeImageVersion"u8)) - { - nodeImageVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("osType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osType = new ContainerServiceOSType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("osSku"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osSku = new ContainerServiceOSSku(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("vmSize"u8)) - { - vmSize = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enableFIPS"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableFIPS = property0.Value.GetBoolean(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolSnapshotData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - creationData, - snapshotType, - kubernetesVersion, - nodeImageVersion, - osType, - osSku, - vmSize, - enableFIPS, - 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(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(NodeImageVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeImageVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeImageVersion)) - { - builder.Append(" nodeImageVersion: "); - if (NodeImageVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NodeImageVersion}'''"); - } - else - { - builder.AppendLine($"'{NodeImageVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSType)) - { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSSku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osSku: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSSku)) - { - builder.Append(" osSku: "); - builder.AppendLine($"'{OSSku.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSize), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmSize: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmSize)) - { - builder.Append(" vmSize: "); - if (VmSize.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{VmSize}'''"); - } - else - { - builder.AppendLine($"'{VmSize}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFips), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableFIPS: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableFips)) - { - builder.Append(" enableFIPS: "); - var boolValue = EnableFips.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - 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(AgentPoolSnapshotData)} does not support writing '{options.Format}' format."); - } - } - - AgentPoolSnapshotData 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); - return DeserializeAgentPoolSnapshotData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AgentPoolSnapshotData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs deleted file mode 100644 index 64208b02be45..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotData.cs +++ /dev/null @@ -1,131 +0,0 @@ -// 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 AgentPoolSnapshot data model. - /// A node pool snapshot resource. - /// - public partial class AgentPoolSnapshotData : 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 AgentPoolSnapshotData(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 agent pool resource ID to create this snapshot. - /// The type of a snapshot. The default is NodePool. - /// 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. - /// The size of the VM. - /// Whether to use a FIPS-enabled OS. - /// Keeps track of any properties unknown to the library. - internal AgentPoolSnapshotData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerServiceCreationData creationData, SnapshotType? snapshotType, string kubernetesVersion, string nodeImageVersion, ContainerServiceOSType? osType, ContainerServiceOSSku? osSku, string vmSize, bool? enableFips, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - CreationData = creationData; - SnapshotType = snapshotType; - KubernetesVersion = kubernetesVersion; - NodeImageVersion = nodeImageVersion; - OSType = osType; - OSSku = osSku; - VmSize = vmSize; - EnableFips = enableFips; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AgentPoolSnapshotData() - { - } - - /// CreationData to be used to specify the source agent pool 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; } - /// The version of Kubernetes. - [WirePath("properties.kubernetesVersion")] - public string KubernetesVersion { get; } - /// The version of node image. - [WirePath("properties.nodeImageVersion")] - public string NodeImageVersion { get; } - /// 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. - [WirePath("properties.osSku")] - public ContainerServiceOSSku? OSSku { get; } - /// The size of the VM. - [WirePath("properties.vmSize")] - public string VmSize { get; } - /// Whether to use a FIPS-enabled OS. - [WirePath("properties.enableFIPS")] - public bool? EnableFips { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.Serialization.cs deleted file mode 100644 index 7e89aba8ec1a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.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 AgentPoolSnapshotResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AgentPoolSnapshotData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AgentPoolSnapshotData 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/AgentPoolSnapshotResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs deleted file mode 100644 index 6045d3413e5b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolSnapshotResource.cs +++ /dev/null @@ -1,703 +0,0 @@ -// 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 an AgentPoolSnapshot 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 GetAgentPoolSnapshotResource method. - /// Otherwise you can get one from its parent resource using the GetAgentPoolSnapshot method. - /// - public partial class AgentPoolSnapshotResource : 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/snapshots/{resourceName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; - private readonly SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; - private readonly AgentPoolSnapshotData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/snapshots"; - - /// Initializes a new instance of the class for mocking. - protected AgentPoolSnapshotResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal AgentPoolSnapshotResource(ArmClient client, AgentPoolSnapshotData 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 AgentPoolSnapshotResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _agentPoolSnapshotSnapshotsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string agentPoolSnapshotSnapshotsApiVersion); - _agentPoolSnapshotSnapshotsRestClient = new SnapshotsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agentPoolSnapshotSnapshotsApiVersion); -#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 AgentPoolSnapshotData 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 snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Get"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Get"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Delete - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Delete"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _agentPoolSnapshotSnapshotsRestClient.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 snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Delete - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Delete"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var uri = _agentPoolSnapshotSnapshotsRestClient.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 snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_UpdateTags - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters supplied to the Update 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Update"); - scope.Start(); - try - { - var response = await _agentPoolSnapshotSnapshotsRestClient.UpdateTagsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AgentPoolSnapshotResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates tags on a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_UpdateTags - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Parameters supplied to the Update 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.Update"); - scope.Start(); - try - { - var response = _agentPoolSnapshotSnapshotsRestClient.UpdateTags(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, containerServiceTagsObject, cancellationToken); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 _agentPoolSnapshotSnapshotsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new AgentPoolSnapshotResource(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/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _agentPoolSnapshotSnapshotsClientDiagnostics.CreateScope("AgentPoolSnapshotResource.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 = _agentPoolSnapshotSnapshotsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new AgentPoolSnapshotResource(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/AgentPoolUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs deleted file mode 100644 index f38a54871b37..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.cs +++ /dev/null @@ -1,104 +0,0 @@ -// 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 AgentPoolUpgradeProfile data model. - /// The list of available upgrades for an agent pool. - /// - public partial class AgentPoolUpgradeProfileData : 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 . - /// The Kubernetes version (major.minor.patch). - /// The operating system type. The default is Linux. - /// is null. - internal AgentPoolUpgradeProfileData(string kubernetesVersion, ContainerServiceOSType osType) - { - Argument.AssertNotNull(kubernetesVersion, nameof(kubernetesVersion)); - - KubernetesVersion = kubernetesVersion; - OSType = osType; - Upgrades = new ChangeTrackingList(); - } - - /// 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. - /// 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) - { - KubernetesVersion = kubernetesVersion; - OSType = osType; - Upgrades = upgrades; - LatestNodeImageVersion = latestNodeImageVersion; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AgentPoolUpgradeProfileData() - { - } - - /// The Kubernetes version (major.minor.patch). - [WirePath("properties.kubernetesVersion")] - public string KubernetesVersion { get; } - /// The operating system type. The default is Linux. - [WirePath("properties.osType")] - public ContainerServiceOSType OSType { get; } - /// List of orchestrator types and versions available for upgrade. - [WirePath("properties.upgrades")] - public IReadOnlyList Upgrades { 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.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.Serialization.cs deleted file mode 100644 index 1f850d48dafc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.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 AgentPoolUpgradeProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - AgentPoolUpgradeProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - AgentPoolUpgradeProfileData 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/AgentPoolUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs deleted file mode 100644 index 9c357b37cb3d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileResource.cs +++ /dev/null @@ -1,171 +0,0 @@ -// 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 an AgentPoolUpgradeProfile 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 GetAgentPoolUpgradeProfileResource method. - /// Otherwise you can get one from its parent resource using the GetAgentPoolUpgradeProfile method. - /// - public partial class AgentPoolUpgradeProfileResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The resourceName. - /// The agentPoolName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _agentPoolUpgradeProfileAgentPoolsClientDiagnostics; - private readonly AgentPoolsRestOperations _agentPoolUpgradeProfileAgentPoolsRestClient; - private readonly AgentPoolUpgradeProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/agentPools/upgradeProfiles"; - - /// Initializes a new instance of the class for mocking. - protected AgentPoolUpgradeProfileResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal AgentPoolUpgradeProfileResource(ArmClient client, AgentPoolUpgradeProfileData 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 AgentPoolUpgradeProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _agentPoolUpgradeProfileAgentPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string agentPoolUpgradeProfileAgentPoolsApiVersion); - _agentPoolUpgradeProfileAgentPoolsRestClient = new AgentPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agentPoolUpgradeProfileAgentPoolsApiVersion); -#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 AgentPoolUpgradeProfileData 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 upgrade profile for an agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default - /// - /// - /// Operation Id - /// AgentPools_GetUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolUpgradeProfileAgentPoolsClientDiagnostics.CreateScope("AgentPoolUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = await _agentPoolUpgradeProfileAgentPoolsRestClient.GetUpgradeProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the upgrade profile for an agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeProfiles/default - /// - /// - /// Operation Id - /// AgentPools_GetUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolUpgradeProfileAgentPoolsClientDiagnostics.CreateScope("AgentPoolUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = _agentPoolUpgradeProfileAgentPoolsRestClient.GetUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new AgentPoolUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs index d8ce03a6d98a..7e98eae033c1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ArmContainerServiceModelFactory.cs @@ -8,956 +8,318 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Net; using Azure.Core; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; 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. - public static KubernetesVersionListResult KubernetesVersionListResult(IEnumerable values = null) - { - values ??= new List(); - - return new KubernetesVersionListResult(values?.ToList(), serializedAdditionalRawData: 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. - public static KubernetesVersion KubernetesVersion(string version = null, IEnumerable capabilitiesSupportPlan = 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); - } - - /// Initializes a new instance of . - /// Possible upgrade path for given patch version. - /// A new instance for mocking. - public static KubernetesPatchVersion KubernetesPatchVersion(IEnumerable upgrades = null) - { - upgrades ??= new List(); - - return new KubernetesPatchVersion(upgrades?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The managed cluster SKU. - /// The extended location of the Virtual Machine. - /// The identity of the managed cluster, if configured. - /// The current provisioning state. - /// The Power State of the cluster. - /// 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. - /// 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. - /// The FQDN of private cluster. - /// The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. - /// The agent pool properties. - /// The profile for Linux VMs in the Managed Cluster. - /// The profile for Windows VMs in the Managed Cluster. - /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. - /// The profile of managed cluster add-on. - /// 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. - /// 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 network configuration profile. - /// The Azure Active Directory configuration. - /// The auto upgrade configuration. - /// Settings for upgrading a cluster. - /// 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. - /// 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. - /// 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. - /// Service mesh profile for a managed cluster. - /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). - /// 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) + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// Managed identity. + /// The status of the last operation. + /// The FleetHubProfile configures the Fleet's hub. + /// Status information for the fleet. + /// A new instance for mocking. + public static FleetData FleetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ETag? etag = null, ResourceManager.Models.ManagedServiceIdentity identity = null, FleetProvisioningState? provisioningState = null, FleetHubProfile hubProfile = null, FleetStatus status = null) { tags ??= new Dictionary(); - agentPoolProfiles ??= new List(); - addonProfiles ??= new Dictionary(); - identityProfile ??= new Dictionary(); - privateLinkResources ??= new List(); - return new ContainerServiceManagedClusterData( + return new FleetData( id, name, resourceType, systemData, tags, location, - sku, - extendedLocation, - clusterIdentity, - provisioningState, - powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, - maxAgentPools, - kubernetesVersion, - currentKubernetesVersion, - dnsPrefix, - fqdnSubdomain, - fqdn, - privateFqdn, - azurePortalFqdn, - agentPoolProfiles?.ToList(), - linuxProfile, - windowsProfile, - servicePrincipalProfile, - addonProfiles, - podIdentityProfile, - oidcIssuerProfile, - nodeResourceGroup, - enableRbac, - supportPlan, - enablePodSecurityPolicy, - networkProfile, - aadProfile, - autoUpgradeProfile, - upgradeOverrideSettings != null ? new ClusterUpgradeSettings(upgradeOverrideSettings, serializedAdditionalRawData: null) : null, - autoScalerProfile, - apiServerAccessProfile, - diskEncryptionSetId, - identityProfile, - privateLinkResources?.ToList(), - disableLocalAccounts, - httpProxyConfig, - securityProfile, - storageProfile, - publicNetworkAccess, - workloadAutoScalerProfile, - azureMonitorMetrics != null ? new ManagedClusterAzureMonitorProfile(azureMonitorMetrics, serializedAdditionalRawData: null) : null, - serviceMeshProfile, - resourceId, - 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. - 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) - { - availabilityZones ??= new List(); - tags ??= new Dictionary(); - nodeLabels ??= new Dictionary(); - nodeTaints ??= new List(); - - return new ManagedClusterAgentPoolProfile( - count, - vmSize, - osDiskSizeInGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - agentPoolType, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, - provisioningState, - powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, - availabilityZones?.ToList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags, - nodeLabels, - nodeTaints?.ToList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFips, - gpuInstanceProfile, - creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, - capacityReservationGroupId, - hostGroupId, - networkProfile, - serializedAdditionalRawData: null, - name); - } - - /// 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. - 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) - { - availabilityZones ??= new List(); - tags ??= new Dictionary(); - nodeLabels ??= new Dictionary(); - nodeTaints ??= new List(); - - return new ManagedClusterAgentPoolProfileProperties( - count, - vmSize, - osDiskSizeInGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - agentPoolType, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, - provisioningState, - powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, - availabilityZones?.ToList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags, - nodeLabels, - nodeTaints?.ToList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFips, - gpuInstanceProfile, - creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, - capacityReservationGroupId, - hostGroupId, - networkProfile, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Whether the add-on is enabled or not. - /// Key-value pairs for configuring an add-on. - /// Information of user assigned identity used by this add-on. - /// A new instance for mocking. - public static ManagedClusterAddonProfile ManagedClusterAddonProfile(bool isEnabled = default, IDictionary config = null, ManagedClusterAddonProfileIdentity identity = null) - { - config ??= new Dictionary(); - - return new ManagedClusterAddonProfile(isEnabled, config, identity, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The name of the pod identity. - /// The namespace of the pod identity. - /// The binding selector to use for the AzureIdentityBinding resource. - /// The user assigned identity details. - /// The current provisioning state of the pod identity. - /// - /// A new instance for mocking. - public static ManagedClusterPodIdentity ManagedClusterPodIdentity(string name = null, string @namespace = null, string bindingSelector = null, ContainerServiceUserAssignedIdentity identity = null, ManagedClusterPodIdentityProvisioningState? provisioningState = null, ResponseError errorDetail = null) - { - return new ManagedClusterPodIdentity( - name, - @namespace, - bindingSelector, + etag, identity, provisioningState, - errorDetail != null ? new ManagedClusterPodIdentityProvisioningInfo(new ManagedClusterPodIdentityProvisioningError(errorDetail, serializedAdditionalRawData: null), serializedAdditionalRawData: null) : null, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The OIDC issuer url of the Managed Cluster. - /// Whether the OIDC issuer is enabled. - /// A new instance for mocking. - public static ManagedClusterOidcIssuerProfile ManagedClusterOidcIssuerProfile(string issuerUriInfo = null, bool? isEnabled = null) - { - return new ManagedClusterOidcIssuerProfile(issuerUriInfo, isEnabled, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The ID of the private link resource. - /// The name of the private link resource. - /// The resource type. - /// The group ID of the resource. - /// The RequiredMembers of the resource. - /// The private link service ID of the resource, this field is exposed only to NRP internally. - /// A new instance for mocking. - public static ContainerServicePrivateLinkResourceData ContainerServicePrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType? resourceType = null, string groupId = null, IEnumerable requiredMembers = null, ResourceIdentifier privateLinkServiceId = null) - { - requiredMembers ??= new List(); - - return new ContainerServicePrivateLinkResourceData( - id, - name, - resourceType, - groupId, - requiredMembers?.ToList(), - privateLinkServiceId, + hubProfile, + status, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The list of available upgrade versions for the control plane. - /// The list of available upgrade versions for agent pools. - /// A new instance for mocking. - public static ManagedClusterUpgradeProfileData ManagedClusterUpgradeProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedClusterPoolUpgradeProfile controlPlaneProfile = null, IEnumerable agentPoolProfiles = null) + /// Initializes a new instance of . + /// DNS prefix used to create the FQDN for the Fleet hub. + /// The access profile for the Fleet hub API server. + /// The agent profile for the Fleet hub. + /// The FQDN of the Fleet hub. + /// The Kubernetes version of the Fleet hub. + /// The Azure Portal FQDN of the Fleet hub. + /// A new instance for mocking. + public static FleetHubProfile FleetHubProfile(string dnsPrefix = null, ApiServerAccessProfile apiServerAccessProfile = null, AgentProfile agentProfile = null, string fqdn = null, string kubernetesVersion = null, string portalFqdn = null) { - agentPoolProfiles ??= new List(); - - return new ManagedClusterUpgradeProfileData( - id, - name, - resourceType, - systemData, - controlPlaneProfile, - agentPoolProfiles?.ToList(), + return new FleetHubProfile( + dnsPrefix, + apiServerAccessProfile, + agentProfile, + fqdn, + kubernetesVersion, + portalFqdn, 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. - public static ManagedClusterPoolUpgradeProfile ManagedClusterPoolUpgradeProfile(string kubernetesVersion = null, string name = null, ContainerServiceOSType osType = default, IEnumerable upgrades = null) + /// Initializes a new instance of . + /// The last operation ID for the fleet. + /// The last operation error for the fleet. + /// A new instance for mocking. + public static FleetStatus FleetStatus(string lastOperationId = null, ResponseError lastOperationError = null) { - upgrades ??= new List(); - - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades?.ToList(), serializedAdditionalRawData: null); + return new FleetStatus(lastOperationId, lastOperationError, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The Kubernetes version (major.minor.patch). - /// Whether the Kubernetes version is currently in preview. - /// A new instance for mocking. - public static ManagedClusterPoolUpgradeProfileUpgradesItem ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) - { - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The tags. - /// The location. - /// Base64-encoded Kubernetes configuration file. - /// A new instance for mocking. - public static ManagedClusterAccessProfile ManagedClusterAccessProfile(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, byte[] kubeConfig = null) - { - tags ??= new Dictionary(); - - return new ManagedClusterAccessProfile( + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the AutoUpgradeProfile resource. + /// The resource id of the UpdateStrategy resource to reference. If not specified, the auto upgrade will run on all clusters which are members of the fleet. + /// Configures how auto-upgrade will be run. + /// The node image upgrade to be applied to the target clusters in auto upgrade. + /// + /// If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. + /// If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed clusters. + /// This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. + /// By default, this is set to False. + /// + /// A new instance for mocking. + public static AutoUpgradeProfileData AutoUpgradeProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, AutoUpgradeProfileProvisioningState? provisioningState = null, ResourceIdentifier updateStrategyId = null, UpgradeChannel? channel = null, AutoUpgradeNodeImageSelectionType? selectionType = null, bool? disabled = null) + { + return new AutoUpgradeProfileData( id, name, resourceType, systemData, - tags, - location, - kubeConfig, + etag, + provisioningState, + updateStrategyId, + channel, + selectionType.HasValue ? new AutoUpgradeNodeImageSelection(selectionType.Value, serializedAdditionalRawData: null) : null, + disabled, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Base64-encoded Kubernetes configuration file. - /// A new instance for mocking. - public static ManagedClusterCredentials ManagedClusterCredentials(IEnumerable kubeconfigs = null) + /// Initializes a new instance of . + /// Array of base64-encoded Kubernetes configuration files. + /// A new instance for mocking. + public static FleetCredentialResults FleetCredentialResults(IEnumerable kubeconfigs = null) { - kubeconfigs ??= new List(); + kubeconfigs ??= new List(); - return new ManagedClusterCredentials(kubeconfigs?.ToList(), serializedAdditionalRawData: null); + return new FleetCredentialResults(kubeconfigs?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. - /// A new instance for mocking. - public static ManagedClusterCredential ManagedClusterCredential(string name = null, byte[] value = null) - { - return new ManagedClusterCredential(name, value, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. - /// Time slots on which upgrade is not allowed. - /// Maintenance window for the maintenance configuration. - /// A new instance for mocking. - public static ContainerServiceMaintenanceConfigurationData ContainerServiceMaintenanceConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable timesInWeek = null, IEnumerable notAllowedTimes = null, ContainerServiceMaintenanceWindow maintenanceWindow = null) + /// A new instance for mocking. + public static FleetCredentialResult FleetCredentialResult(string name = null, byte[] value = null) { - timesInWeek ??= new List(); - notAllowedTimes ??= new List(); - - return new ContainerServiceMaintenanceConfigurationData( - id, - name, - resourceType, - systemData, - timesInWeek?.ToList(), - notAllowedTimes?.ToList(), - maintenanceWindow, - serializedAdditionalRawData: null); + return new FleetCredentialResult(name, value, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// 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. - 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) - { - availabilityZones ??= new List(); - tags ??= new Dictionary(); - nodeLabels ??= new Dictionary(); - nodeTaints ??= new List(); - - return new ContainerServiceAgentPoolData( + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// The group this member belongs to for multi-cluster update management. + /// The status of the last operation. + /// The labels for the fleet member. + /// Status information of the last operation for fleet member. + /// A new instance for mocking. + public static FleetMemberData FleetMemberData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, ResourceIdentifier clusterResourceId = null, string group = null, FleetMemberProvisioningState? provisioningState = null, IDictionary labels = null, FleetMemberStatus status = null) + { + labels ??= new Dictionary(); + + return new FleetMemberData( id, name, resourceType, systemData, - count, - vmSize, - osDiskSizeInGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - typePropertiesType, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, + etag, + clusterResourceId, + group, provisioningState, - powerStateCode != null ? new ContainerServicePowerState(powerStateCode, serializedAdditionalRawData: null) : null, - availabilityZones?.ToList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags, - nodeLabels, - nodeTaints?.ToList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFips, - gpuInstanceProfile, - creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, - capacityReservationGroupId, - hostGroupId, - networkProfile, - serializedAdditionalRawData: null); - } - - /// 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. - 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) - { - upgrades ??= new List(); - - return new AgentPoolUpgradeProfileData( - id, - name, - resourceType, - systemData, - kubernetesVersion, - osType, - upgrades?.ToList(), - latestNodeImageVersion, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The Kubernetes version (major.minor.patch). - /// Whether the Kubernetes version is currently in preview. - /// A new instance for mocking. - public static AgentPoolUpgradeProfilePropertiesUpgradesItem AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion = null, bool? isPreview = null) - { - return new AgentPoolUpgradeProfilePropertiesUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// List of versions available for agent pool. - /// A new instance for mocking. - public static AgentPoolAvailableVersions AgentPoolAvailableVersions(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable agentPoolVersions = null) - { - agentPoolVersions ??= new List(); - - return new AgentPoolAvailableVersions( - id, - name, - resourceType, - systemData, - agentPoolVersions?.ToList(), + labels, + status, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Whether this version is the default agent pool version. - /// The Kubernetes version (major.minor.patch). - /// Whether Kubernetes version is currently in preview. - /// A new instance for mocking. - public static AgentPoolAvailableVersion AgentPoolAvailableVersion(bool? isDefault = null, string kubernetesVersion = null, bool? isPreview = null) + /// Initializes a new instance of . + /// The last operation ID for the fleet member. + /// The last operation error of the fleet member. + /// A new instance for mocking. + public static FleetMemberStatus FleetMemberStatus(string lastOperationId = null, ResponseError lastOperationError = null) { - return new AgentPoolAvailableVersion(isDefault, kubernetesVersion, isPreview, serializedAdditionalRawData: null); + return new FleetMemberStatus(lastOperationId, lastOperationError, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The current provisioning state. - /// The resource of private endpoint. - /// A collection of information about the state of the connection between service consumer and provider. - /// A new instance for mocking. - public static ContainerServicePrivateEndpointConnectionData ContainerServicePrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState = null, ResourceIdentifier privateEndpointId = null, ContainerServicePrivateLinkServiceConnectionState connectionState = null) - { - return new ContainerServicePrivateEndpointConnectionData( + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateRun resource. + /// + /// The resource id of the FleetUpdateStrategy resource to reference. + /// + /// When creating a new run, there are three ways to define a strategy for the run: + /// 1. Define a new strategy in place: Set the "strategy" field. + /// 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + /// 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + /// + /// Setting both "updateStrategyId" and "strategy" is invalid. + /// + /// UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in the "strategy" field. + /// Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + /// UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun. + /// + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + /// The status of the UpdateRun. + /// A new instance for mocking. + public static UpdateRunData UpdateRunData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, UpdateRunProvisioningState? provisioningState = null, ResourceIdentifier updateStrategyId = null, IEnumerable strategyStages = null, ManagedClusterUpdate managedClusterUpdate = null, UpdateRunStatus status = null) + { + strategyStages ??= new List(); + + return new UpdateRunData( id, name, resourceType, systemData, + etag, provisioningState, - privateEndpointId != null ? ResourceManagerModelFactory.WritableSubResource(privateEndpointId) : null, - connectionState, + updateStrategyId, + strategyStages != null ? new UpdateRunStrategy(strategyStages?.ToList(), serializedAdditionalRawData: null) : null, + managedClusterUpdate, + status, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The command to run. - /// A base64 encoded zip file containing the files required by the command. - /// AuthToken issued for AKS AAD Server App. - /// A new instance for mocking. - public static ManagedClusterRunCommandContent ManagedClusterRunCommandContent(string command = null, string context = null, string clusterToken = null) + /// Initializes a new instance of . + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + /// A new instance for mocking. + public static NodeImageVersion NodeImageVersion(string version = null) { - return new ManagedClusterRunCommandContent(command, context, clusterToken, serializedAdditionalRawData: null); + return new NodeImageVersion(version, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The command id. - /// provisioning State. - /// The exit code of the command. - /// The time when the command started. - /// The time when the command finished. - /// The command output. - /// An explanation of why provisioningState is set to failed (if so). - /// A new instance for mocking. - public static ManagedClusterRunCommandResult ManagedClusterRunCommandResult(string id = null, string provisioningState = null, int? exitCode = null, DateTimeOffset? startedOn = null, DateTimeOffset? finishedOn = null, string logs = null, string reason = null) + /// Initializes a new instance of . + /// The status of the UpdateRun. + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + /// A new instance for mocking. + public static UpdateRunStatus UpdateRunStatus(UpdateStatus status = null, IEnumerable stages = null, IEnumerable selectedNodeImageVersions = null) { - return new ManagedClusterRunCommandResult( - id, - provisioningState, - exitCode, - startedOn, - finishedOn, - logs, - reason, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. - /// The endpoints that AKS agent nodes connect to. - /// A new instance for mocking. - public static ContainerServiceOutboundEnvironmentEndpoint ContainerServiceOutboundEnvironmentEndpoint(string category = null, IEnumerable endpoints = null) - { - endpoints ??= new List(); + stages ??= new List(); + selectedNodeImageVersions ??= new List(); - return new ContainerServiceOutboundEnvironmentEndpoint(category, endpoints?.ToList(), serializedAdditionalRawData: null); + return new UpdateRunStatus(status, stages?.ToList(), selectedNodeImageVersions != null ? new NodeImageSelectionStatus(selectedNodeImageVersions?.ToList(), serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The domain name of the dependency. - /// The Ports and Protocols used when connecting to domainName. - /// A new instance for mocking. - public static ContainerServiceEndpointDependency ContainerServiceEndpointDependency(string domainName = null, IEnumerable endpointDetails = null) + /// Initializes a new instance of . + /// The time the operation or group was started. + /// The time the operation or group was completed. + /// The State of the operation or group. + /// The error details when a failure is encountered. + /// A new instance for mocking. + public static UpdateStatus UpdateStatus(DateTimeOffset? startOn = null, DateTimeOffset? completedOn = null, UpdateState? state = null, ResponseError error = null) { - endpointDetails ??= new List(); - - return new ContainerServiceEndpointDependency(domainName, endpointDetails?.ToList(), serializedAdditionalRawData: null); + return new UpdateStatus(startOn, completedOn, state, error, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// An IP Address that Domain Name currently resolves to. - /// The port an endpoint is connected to. - /// The protocol used for connection. - /// Description of the detail. - /// A new instance for mocking. - public static ContainerServiceEndpointDetail ContainerServiceEndpointDetail(IPAddress ipAddress = null, int? port = null, string protocol = null, string description = null) + /// Initializes a new instance of . + /// The status of the UpdateStage. + /// The name of the UpdateStage. + /// The list of groups to be updated as part of this UpdateStage. + /// The status of the wait period configured on the UpdateStage. + /// A new instance for mocking. + public static UpdateStageStatus UpdateStageStatus(UpdateStatus status = null, string name = null, IEnumerable groups = null, WaitStatus afterStageWaitStatus = null) { - return new ContainerServiceEndpointDetail(ipAddress, port, protocol, description, serializedAdditionalRawData: null); + groups ??= new List(); + + return new UpdateStageStatus(status, name, groups?.ToList(), afterStageWaitStatus, 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 agent pool resource ID to create this snapshot. - /// The type of a snapshot. The default is NodePool. - /// 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. - /// The size of the VM. - /// Whether to use a FIPS-enabled OS. - /// A new instance for mocking. - public static AgentPoolSnapshotData AgentPoolSnapshotData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ResourceIdentifier creationDataSourceResourceId = null, SnapshotType? snapshotType = null, string kubernetesVersion = null, string nodeImageVersion = null, ContainerServiceOSType? osType = null, ContainerServiceOSSku? osSku = null, string vmSize = null, bool? enableFips = null) + /// Initializes a new instance of . + /// The status of the UpdateGroup. + /// The name of the UpdateGroup. + /// The list of member this UpdateGroup updates. + /// A new instance for mocking. + public static UpdateGroupStatus UpdateGroupStatus(UpdateStatus status = null, string name = null, IEnumerable members = null) { - tags ??= new Dictionary(); + members ??= new List(); - return new AgentPoolSnapshotData( - id, - name, - resourceType, - systemData, - tags, - location, - creationDataSourceResourceId != null ? new ContainerServiceCreationData(creationDataSourceResourceId, serializedAdditionalRawData: null) : null, - snapshotType, - kubernetesVersion, - nodeImageVersion, - osType, - osSku, - vmSize, - enableFips, - serializedAdditionalRawData: null); + return new UpdateGroupStatus(status, name, members?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Mesh revision profile properties for a mesh. - /// A new instance for mocking. - public static MeshRevisionProfileData MeshRevisionProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable meshRevisions = null) + /// Initializes a new instance of . + /// The status of the MemberUpdate operation. + /// The name of the FleetMember. + /// The Azure resource id of the target Kubernetes cluster. + /// The operation resource id of the latest attempt to perform the operation. + /// The status message after processing the member update operation. + /// A new instance for mocking. + public static MemberUpdateStatus MemberUpdateStatus(UpdateStatus status = null, string name = null, ResourceIdentifier clusterResourceId = null, string operationId = null, string message = null) { - meshRevisions ??= new List(); - - return new MeshRevisionProfileData( - id, + return new MemberUpdateStatus( + status, name, - resourceType, - systemData, - meshRevisions != null ? new MeshRevisionProfileProperties(meshRevisions?.ToList(), serializedAdditionalRawData: null) : null, + clusterResourceId, + operationId, + message, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Mesh upgrade profile properties for a major.minor release. - /// A new instance for mocking. - public static MeshUpgradeProfileData MeshUpgradeProfileData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, MeshUpgradeProfileProperties properties = null) + /// Initializes a new instance of . + /// The status of the wait duration. + /// The wait duration configured in seconds. + /// A new instance for mocking. + public static WaitStatus WaitStatus(UpdateStatus status = null, int? waitDurationInSeconds = null) { - return new MeshUpgradeProfileData( - id, - name, - resourceType, - systemData, - properties, - serializedAdditionalRawData: null); + return new WaitStatus(status, waitDurationInSeconds, 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) + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateStrategy resource. + /// Defines the update sequence of the clusters. + /// A new instance for mocking. + public static FleetUpdateStrategyData FleetUpdateStrategyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ETag? etag = null, FleetUpdateStrategyProvisioningState? provisioningState = null, IEnumerable strategyStages = null) { - roles ??= new List(); + strategyStages ??= new List(); - return new ContainerServiceTrustedAccessRoleBindingData( + return new FleetUpdateStrategyData( id, name, resourceType, systemData, + etag, 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) - { - 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(), + strategyStages != null ? new UpdateRunStrategy(strategyStages?.ToList(), serializedAdditionalRawData: null) : null, serializedAdditionalRawData: null); } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileCollection.cs new file mode 100644 index 000000000000..ca73e9222994 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileCollection.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 an instance call the GetAutoUpgradeProfiles method from an instance of . + /// + public partial class AutoUpgradeProfileCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _autoUpgradeProfileClientDiagnostics; + private readonly AutoUpgradeProfilesRestOperations _autoUpgradeProfileRestClient; + + /// Initializes a new instance of the class for mocking. + protected AutoUpgradeProfileCollection() + { + } + + /// 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 AutoUpgradeProfileCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _autoUpgradeProfileClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", AutoUpgradeProfileResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AutoUpgradeProfileResource.ResourceType, out string autoUpgradeProfileApiVersion); + _autoUpgradeProfileRestClient = new AutoUpgradeProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, autoUpgradeProfileApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != FleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, FleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 AutoUpgradeProfile resource. + /// Resource create parameters. + /// 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 autoUpgradeProfileName, AutoUpgradeProfileData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _autoUpgradeProfileRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new AutoUpgradeProfileOperationSource(Client), _autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 AutoUpgradeProfile resource. + /// Resource create parameters. + /// 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 autoUpgradeProfileName, AutoUpgradeProfileData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _autoUpgradeProfileRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new AutoUpgradeProfileOperationSource(Client), _autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile 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 autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.Get"); + scope.Start(); + try + { + var response = await _autoUpgradeProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.Get"); + scope.Start(); + try + { + var response = _autoUpgradeProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List AutoUpgradeProfile resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _autoUpgradeProfileRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _autoUpgradeProfileRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AutoUpgradeProfileResource(Client, AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(e)), _autoUpgradeProfileClientDiagnostics, Pipeline, "AutoUpgradeProfileCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List AutoUpgradeProfile resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _autoUpgradeProfileRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _autoUpgradeProfileRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AutoUpgradeProfileResource(Client, AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(e)), _autoUpgradeProfileClientDiagnostics, Pipeline, "AutoUpgradeProfileCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile 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 autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.Exists"); + scope.Start(); + try + { + var response = await _autoUpgradeProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, 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/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.Exists"); + scope.Start(); + try + { + var response = _autoUpgradeProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, 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/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile 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 autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _autoUpgradeProfileRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(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/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); + + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileCollection.GetIfExists"); + scope.Start(); + try + { + var response = _autoUpgradeProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, autoUpgradeProfileName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(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/ContainerServiceMaintenanceConfigurationData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.Serialization.cs similarity index 54% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.Serialization.cs index cde4d80a25cc..4cf6e3dd38e0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.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 ContainerServiceMaintenanceConfigurationData : IUtf8JsonSerializable, IJsonModel + public partial class AutoUpgradeProfileData : 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,56 +31,61 @@ void IJsonModel.Write(Utf8JsonWrit /// 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(ContainerServiceMaintenanceConfigurationData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileData)} 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()); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsCollectionDefined(TimesInWeek)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) { - writer.WritePropertyName("timeInWeek"u8); - writer.WriteStartArray(); - foreach (var item in TimesInWeek) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (Optional.IsCollectionDefined(NotAllowedTimes)) + if (Optional.IsDefined(UpdateStrategyId)) { - writer.WritePropertyName("notAllowedTime"u8); - writer.WriteStartArray(); - foreach (var item in NotAllowedTimes) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("updateStrategyId"u8); + writer.WriteStringValue(UpdateStrategyId); + } + if (Optional.IsDefined(Channel)) + { + writer.WritePropertyName("channel"u8); + writer.WriteStringValue(Channel.Value.ToString()); } - if (Optional.IsDefined(MaintenanceWindow)) + if (Optional.IsDefined(NodeImageSelection)) { - writer.WritePropertyName("maintenanceWindow"u8); - writer.WriteObjectValue(MaintenanceWindow, options); + writer.WritePropertyName("nodeImageSelection"u8); + writer.WriteObjectValue(NodeImageSelection, options); + } + if (Optional.IsDefined(Disabled)) + { + writer.WritePropertyName("disabled"u8); + writer.WriteBooleanValue(Disabled.Value); } writer.WriteEndObject(); } - ContainerServiceMaintenanceConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AutoUpgradeProfileData 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(ContainerServiceMaintenanceConfigurationData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement, options); + return DeserializeAutoUpgradeProfileData(document.RootElement, options); } - internal static ContainerServiceMaintenanceConfigurationData DeserializeContainerServiceMaintenanceConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + internal static AutoUpgradeProfileData DeserializeAutoUpgradeProfileData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -89,17 +93,29 @@ internal static ContainerServiceMaintenanceConfigurationData DeserializeContaine { return null; } + ETag? etag = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - IList timeInWeek = default; - IList notAllowedTime = default; - ContainerServiceMaintenanceWindow maintenanceWindow = default; + AutoUpgradeProfileProvisioningState? provisioningState = default; + ResourceIdentifier updateStrategyId = default; + UpgradeChannel? channel = default; + AutoUpgradeNodeImageSelection nodeImageSelection = default; + bool? disabled = 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("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -133,41 +149,49 @@ internal static ContainerServiceMaintenanceConfigurationData DeserializeContaine } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("timeInWeek"u8)) + if (property0.NameEquals("provisioningState"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) + provisioningState = new AutoUpgradeProfileProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("updateStrategyId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) { - array.Add(ContainerServiceTimeInWeek.DeserializeContainerServiceTimeInWeek(item, options)); + continue; } - timeInWeek = array; + updateStrategyId = new ResourceIdentifier(property0.Value.GetString()); continue; } - if (property0.NameEquals("notAllowedTime"u8)) + if (property0.NameEquals("channel"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) + channel = new UpgradeChannel(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("nodeImageSelection"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) { - array.Add(ContainerServiceTimeSpan.DeserializeContainerServiceTimeSpan(item, options)); + continue; } - notAllowedTime = array; + nodeImageSelection = AutoUpgradeNodeImageSelection.DeserializeAutoUpgradeNodeImageSelection(property0.Value, options); continue; } - if (property0.NameEquals("maintenanceWindow"u8)) + if (property0.NameEquals("disabled"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - maintenanceWindow = ContainerServiceMaintenanceWindow.DeserializeContainerServiceMaintenanceWindow(property0.Value, options); + disabled = property0.Value.GetBoolean(); continue; } } @@ -179,14 +203,17 @@ internal static ContainerServiceMaintenanceConfigurationData DeserializeContaine } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceConfigurationData( + return new AutoUpgradeProfileData( id, name, type, systemData, - timeInWeek ?? new ChangeTrackingList(), - notAllowedTime ?? new ChangeTrackingList(), - maintenanceWindow, + etag, + provisioningState, + updateStrategyId, + channel, + nodeImageSelection, + disabled, serializedAdditionalRawData); } @@ -224,6 +251,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(Id), out propertyOverride); if (hasPropertyOverride) { @@ -256,64 +298,84 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TimesInWeek), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" timeInWeek: "); + builder.Append(" provisioningState: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(TimesInWeek)) + if (Optional.IsDefined(ProvisioningState)) { - if (TimesInWeek.Any()) - { - builder.Append(" timeInWeek: "); - builder.AppendLine("["); - foreach (var item in TimesInWeek) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " timeInWeek: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotAllowedTimes), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpdateStrategyId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" notAllowedTime: "); + builder.Append(" updateStrategyId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(NotAllowedTimes)) + if (Optional.IsDefined(UpdateStrategyId)) { - if (NotAllowedTimes.Any()) - { - builder.Append(" notAllowedTime: "); - builder.AppendLine("["); - foreach (var item in NotAllowedTimes) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " notAllowedTime: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" updateStrategyId: "); + builder.AppendLine($"'{UpdateStrategyId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Channel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" channel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Channel)) + { + builder.Append(" channel: "); + builder.AppendLine($"'{Channel.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("SelectionType", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeImageSelection: "); + builder.AppendLine("{"); + builder.AppendLine(" nodeImageSelection: {"); + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(NodeImageSelection)) + { + builder.Append(" nodeImageSelection: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeImageSelection, options, 4, false, " nodeImageSelection: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaintenanceWindow), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Disabled), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" maintenanceWindow: "); + builder.Append(" disabled: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(MaintenanceWindow)) + if (Optional.IsDefined(Disabled)) { - builder.Append(" maintenanceWindow: "); - BicepSerializationHelpers.AppendChildObject(builder, MaintenanceWindow, options, 4, false, " maintenanceWindow: "); + builder.Append(" disabled: "); + var boolValue = Disabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); } } @@ -322,9 +384,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -333,26 +395,26 @@ BinaryData IPersistableModel.Write case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceConfigurationData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileData)} does not support writing '{options.Format}' format."); } } - ContainerServiceMaintenanceConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AutoUpgradeProfileData 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); - return DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement, options); + return DeserializeAutoUpgradeProfileData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceConfigurationData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileData)} 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/AutoUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.cs new file mode 100644 index 000000000000..b31e9ff473aa --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileData.cs @@ -0,0 +1,121 @@ +// 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 AutoUpgradeProfile data model. + /// The AutoUpgradeProfile resource. + /// + public partial class AutoUpgradeProfileData : 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 AutoUpgradeProfileData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the AutoUpgradeProfile resource. + /// The resource id of the UpdateStrategy resource to reference. If not specified, the auto upgrade will run on all clusters which are members of the fleet. + /// Configures how auto-upgrade will be run. + /// The node image upgrade to be applied to the target clusters in auto upgrade. + /// + /// If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. + /// If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed clusters. + /// This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. + /// By default, this is set to False. + /// + /// Keeps track of any properties unknown to the library. + internal AutoUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, AutoUpgradeProfileProvisioningState? provisioningState, ResourceIdentifier updateStrategyId, UpgradeChannel? channel, AutoUpgradeNodeImageSelection nodeImageSelection, bool? disabled, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + ProvisioningState = provisioningState; + UpdateStrategyId = updateStrategyId; + Channel = channel; + NodeImageSelection = nodeImageSelection; + Disabled = disabled; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + [WirePath("eTag")] + public ETag? ETag { get; } + /// The provisioning state of the AutoUpgradeProfile resource. + [WirePath("properties.provisioningState")] + public AutoUpgradeProfileProvisioningState? ProvisioningState { get; } + /// The resource id of the UpdateStrategy resource to reference. If not specified, the auto upgrade will run on all clusters which are members of the fleet. + [WirePath("properties.updateStrategyId")] + public ResourceIdentifier UpdateStrategyId { get; set; } + /// Configures how auto-upgrade will be run. + [WirePath("properties.channel")] + public UpgradeChannel? Channel { get; set; } + /// The node image upgrade to be applied to the target clusters in auto upgrade. + internal AutoUpgradeNodeImageSelection NodeImageSelection { get; set; } + /// The node image upgrade type. + [WirePath("properties.nodeImageSelection.type")] + public AutoUpgradeNodeImageSelectionType? SelectionType + { + get => NodeImageSelection is null ? default(AutoUpgradeNodeImageSelectionType?) : NodeImageSelection.SelectionType; + set + { + NodeImageSelection = value.HasValue ? new AutoUpgradeNodeImageSelection(value.Value) : null; + } + } + + /// + /// If set to False: the auto upgrade has effect - target managed clusters will be upgraded on schedule. + /// If set to True: the auto upgrade has no effect - no upgrade will be run on the target managed clusters. + /// This is a boolean and not an enum because enabled/disabled are all available states of the auto upgrade profile. + /// By default, this is set to False. + /// + [WirePath("properties.disabled")] + public bool? Disabled { get; set; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.Serialization.cs new file mode 100644 index 000000000000..de6265a2851f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.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 AutoUpgradeProfileResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AutoUpgradeProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AutoUpgradeProfileData 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/ContainerServiceTrustedAccessRoleBindingResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.cs similarity index 53% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.cs index c31d699ddd30..0f2e6434505a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AutoUpgradeProfileResource.cs @@ -15,53 +15,53 @@ namespace Azure.ResourceManager.ContainerService { /// - /// A Class representing a ContainerServiceTrustedAccessRoleBinding 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 GetContainerServiceTrustedAccessRoleBindingResource method. - /// Otherwise you can get one from its parent resource using the GetContainerServiceTrustedAccessRoleBinding method. + /// A Class representing an AutoUpgradeProfile 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 GetAutoUpgradeProfileResource method. + /// Otherwise you can get one from its parent resource using the GetAutoUpgradeProfile method. /// - public partial class ContainerServiceTrustedAccessRoleBindingResource : ArmResource + public partial class AutoUpgradeProfileResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. - /// The resourceName. - /// The trustedAccessRoleBindingName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + /// The fleetName. + /// The autoUpgradeProfileName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics; - private readonly TrustedAccessRoleBindingsRestOperations _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient; - private readonly ContainerServiceTrustedAccessRoleBindingData _data; + private readonly ClientDiagnostics _autoUpgradeProfileClientDiagnostics; + private readonly AutoUpgradeProfilesRestOperations _autoUpgradeProfileRestClient; + private readonly AutoUpgradeProfileData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/trustedAccessRoleBindings"; + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/autoUpgradeProfiles"; - /// Initializes a new instance of the class for mocking. - protected ContainerServiceTrustedAccessRoleBindingResource() + /// Initializes a new instance of the class for mocking. + protected AutoUpgradeProfileResource() { } - /// 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 ContainerServiceTrustedAccessRoleBindingResource(ArmClient client, ContainerServiceTrustedAccessRoleBindingData data) : this(client, data.Id) + internal AutoUpgradeProfileResource(ArmClient client, AutoUpgradeProfileData 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 ContainerServiceTrustedAccessRoleBindingResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal AutoUpgradeProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsApiVersion); - _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient = new TrustedAccessRoleBindingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsApiVersion); + _autoUpgradeProfileClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string autoUpgradeProfileApiVersion); + _autoUpgradeProfileRestClient = new AutoUpgradeProfilesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, autoUpgradeProfileApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal ContainerServiceTrustedAccessRoleBindingResource(ArmClient client, Reso /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ContainerServiceTrustedAccessRoleBindingData Data + public virtual AutoUpgradeProfileData Data { get { @@ -89,37 +89,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Get a trusted access role binding. + /// Get a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_Get + /// AutoUpgradeProfiles_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Get"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Get"); scope.Start(); try { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _autoUpgradeProfileRestClient.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 ContainerServiceTrustedAccessRoleBindingResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,37 +129,37 @@ public virtual async Task - /// Get a trusted access role binding. + /// Get a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_Get + /// AutoUpgradeProfiles_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Get"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Get"); scope.Start(); try { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _autoUpgradeProfileRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new AutoUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,36 +169,37 @@ public virtual Response Get(Ca } /// - /// Delete a trusted access role binding. + /// Delete a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_Delete + /// AutoUpgradeProfiles_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Delete"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Delete"); scope.Start(); try { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _autoUpgradeProfileRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -211,36 +212,37 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a trusted access role binding. + /// Delete a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_Delete + /// AutoUpgradeProfiles_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Delete"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Delete"); scope.Start(); try { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _autoUpgradeProfileRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -253,40 +255,42 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Create or update a trusted access role binding + /// Create a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_CreateOrUpdate + /// AutoUpgradeProfiles_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 trusted access role binding. + /// Resource create parameters. + /// 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, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AutoUpgradeProfileData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Update"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Update"); scope.Start(); try { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceTrustedAccessRoleBindingOperationSource(Client), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = await _autoUpgradeProfileRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new AutoUpgradeProfileOperationSource(Client), _autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -299,40 +303,42 @@ public virtual async Task - /// Create or update a trusted access role binding + /// Create a AutoUpgradeProfile /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} /// /// /// Operation Id - /// TrustedAccessRoleBindings_CreateOrUpdate + /// AutoUpgradeProfiles_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 trusted access role binding. + /// Resource create parameters. + /// 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, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, AutoUpgradeProfileData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingResource.Update"); + using var scope = _autoUpgradeProfileClientDiagnostics.CreateScope("AutoUpgradeProfileResource.Update"); scope.Start(); try { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceTrustedAccessRoleBindingOperationSource(Client), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); + var response = _autoUpgradeProfileRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new AutoUpgradeProfileOperationSource(Client), _autoUpgradeProfileClientDiagnostics, Pipeline, _autoUpgradeProfileRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs deleted file mode 100644 index 88b66a8d18dd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// 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 GetContainerServiceAgentPools method from an instance of . - /// - public partial class ContainerServiceAgentPoolCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _containerServiceAgentPoolAgentPoolsClientDiagnostics; - private readonly AgentPoolsRestOperations _containerServiceAgentPoolAgentPoolsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceAgentPoolCollection() - { - } - - /// 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 ContainerServiceAgentPoolCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceAgentPoolAgentPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceAgentPoolResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ContainerServiceAgentPoolResource.ResourceType, out string containerServiceAgentPoolAgentPoolsApiVersion); - _containerServiceAgentPoolAgentPoolsRestClient = new AgentPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceAgentPoolAgentPoolsApiVersion); -#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 an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 agent pool. - /// The agent pool 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 agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.CreateOrUpdate"); - 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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates or updates an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 agent pool. - /// The agent pool 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 agentPoolName, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.CreateOrUpdate"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.Get"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.Get"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of agent pools in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools - /// - /// - /// Operation Id - /// AgentPools_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of agent pools in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools - /// - /// - /// Operation Id - /// AgentPools_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceAgentPoolAgentPoolsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceAgentPoolResource(Client, ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(e)), _containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, "ContainerServiceAgentPoolCollection.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} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.Exists"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, 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} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.Exists"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, 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} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceAgentPoolResource(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} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string agentPoolName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolCollection.GetIfExists"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, agentPoolName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceAgentPoolResource(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/ContainerServiceAgentPoolData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs deleted file mode 100644 index 39cdecd5e1e7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.Serialization.cs +++ /dev/null @@ -1,1725 +0,0 @@ -// 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 ContainerServiceAgentPoolData : 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(ContainerServiceAgentPoolData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } - if (Optional.IsDefined(VmSize)) - { - writer.WritePropertyName("vmSize"u8); - writer.WriteStringValue(VmSize); - } - if (Optional.IsDefined(OSDiskSizeInGB)) - { - writer.WritePropertyName("osDiskSizeGB"u8); - writer.WriteNumberValue(OSDiskSizeInGB.Value); - } - if (Optional.IsDefined(OSDiskType)) - { - writer.WritePropertyName("osDiskType"u8); - writer.WriteStringValue(OSDiskType.Value.ToString()); - } - if (Optional.IsDefined(KubeletDiskType)) - { - writer.WritePropertyName("kubeletDiskType"u8); - writer.WriteStringValue(KubeletDiskType.Value.ToString()); - } - if (Optional.IsDefined(WorkloadRuntime)) - { - writer.WritePropertyName("workloadRuntime"u8); - writer.WriteStringValue(WorkloadRuntime.Value.ToString()); - } - if (Optional.IsDefined(VnetSubnetId)) - { - writer.WritePropertyName("vnetSubnetID"u8); - writer.WriteStringValue(VnetSubnetId); - } - if (Optional.IsDefined(PodSubnetId)) - { - writer.WritePropertyName("podSubnetID"u8); - writer.WriteStringValue(PodSubnetId); - } - if (Optional.IsDefined(MaxPods)) - { - writer.WritePropertyName("maxPods"u8); - writer.WriteNumberValue(MaxPods.Value); - } - if (Optional.IsDefined(OSType)) - { - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType.Value.ToString()); - } - if (Optional.IsDefined(OSSku)) - { - writer.WritePropertyName("osSKU"u8); - writer.WriteStringValue(OSSku.Value.ToString()); - } - if (Optional.IsDefined(MaxCount)) - { - writer.WritePropertyName("maxCount"u8); - writer.WriteNumberValue(MaxCount.Value); - } - if (Optional.IsDefined(MinCount)) - { - writer.WritePropertyName("minCount"u8); - writer.WriteNumberValue(MinCount.Value); - } - if (Optional.IsDefined(EnableAutoScaling)) - { - writer.WritePropertyName("enableAutoScaling"u8); - writer.WriteBooleanValue(EnableAutoScaling.Value); - } - if (Optional.IsDefined(ScaleDownMode)) - { - writer.WritePropertyName("scaleDownMode"u8); - writer.WriteStringValue(ScaleDownMode.Value.ToString()); - } - if (Optional.IsDefined(TypePropertiesType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(TypePropertiesType.Value.ToString()); - } - if (Optional.IsDefined(Mode)) - { - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.Value.ToString()); - } - if (Optional.IsDefined(OrchestratorVersion)) - { - writer.WritePropertyName("orchestratorVersion"u8); - writer.WriteStringValue(OrchestratorVersion); - } - if (options.Format != "W" && Optional.IsDefined(CurrentOrchestratorVersion)) - { - writer.WritePropertyName("currentOrchestratorVersion"u8); - writer.WriteStringValue(CurrentOrchestratorVersion); - } - if (options.Format != "W" && Optional.IsDefined(NodeImageVersion)) - { - writer.WritePropertyName("nodeImageVersion"u8); - writer.WriteStringValue(NodeImageVersion); - } - if (Optional.IsDefined(UpgradeSettings)) - { - writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(PowerState)) - { - writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState, options); - } - if (Optional.IsCollectionDefined(AvailabilityZones)) - { - writer.WritePropertyName("availabilityZones"u8); - writer.WriteStartArray(); - foreach (var item in AvailabilityZones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnableNodePublicIP)) - { - writer.WritePropertyName("enableNodePublicIP"u8); - writer.WriteBooleanValue(EnableNodePublicIP.Value); - } - if (Optional.IsDefined(NodePublicIPPrefixId)) - { - writer.WritePropertyName("nodePublicIPPrefixID"u8); - writer.WriteStringValue(NodePublicIPPrefixId); - } - if (Optional.IsDefined(ScaleSetPriority)) - { - writer.WritePropertyName("scaleSetPriority"u8); - writer.WriteStringValue(ScaleSetPriority.Value.ToString()); - } - if (Optional.IsDefined(ScaleSetEvictionPolicy)) - { - writer.WritePropertyName("scaleSetEvictionPolicy"u8); - writer.WriteStringValue(ScaleSetEvictionPolicy.Value.ToString()); - } - if (Optional.IsDefined(SpotMaxPrice)) - { - writer.WritePropertyName("spotMaxPrice"u8); - writer.WriteNumberValue(SpotMaxPrice.Value); - } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(NodeLabels)) - { - writer.WritePropertyName("nodeLabels"u8); - writer.WriteStartObject(); - foreach (var item in NodeLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(NodeTaints)) - { - writer.WritePropertyName("nodeTaints"u8); - writer.WriteStartArray(); - foreach (var item in NodeTaints) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - writer.WritePropertyName("proximityPlacementGroupID"u8); - writer.WriteStringValue(ProximityPlacementGroupId); - } - if (Optional.IsDefined(KubeletConfig)) - { - writer.WritePropertyName("kubeletConfig"u8); - writer.WriteObjectValue(KubeletConfig, options); - } - if (Optional.IsDefined(LinuxOSConfig)) - { - writer.WritePropertyName("linuxOSConfig"u8); - writer.WriteObjectValue(LinuxOSConfig, options); - } - if (Optional.IsDefined(EnableEncryptionAtHost)) - { - writer.WritePropertyName("enableEncryptionAtHost"u8); - writer.WriteBooleanValue(EnableEncryptionAtHost.Value); - } - if (Optional.IsDefined(EnableUltraSsd)) - { - writer.WritePropertyName("enableUltraSSD"u8); - writer.WriteBooleanValue(EnableUltraSsd.Value); - } - if (Optional.IsDefined(EnableFips)) - { - writer.WritePropertyName("enableFIPS"u8); - writer.WriteBooleanValue(EnableFips.Value); - } - if (Optional.IsDefined(GpuInstanceProfile)) - { - writer.WritePropertyName("gpuInstanceProfile"u8); - writer.WriteStringValue(GpuInstanceProfile.Value.ToString()); - } - if (Optional.IsDefined(CreationData)) - { - writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData, options); - } - if (Optional.IsDefined(CapacityReservationGroupId)) - { - writer.WritePropertyName("capacityReservationGroupID"u8); - writer.WriteStringValue(CapacityReservationGroupId); - } - if (Optional.IsDefined(HostGroupId)) - { - writer.WritePropertyName("hostGroupID"u8); - writer.WriteStringValue(HostGroupId); - } - if (Optional.IsDefined(NetworkProfile)) - { - writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile, options); - } - writer.WriteEndObject(); - } - - ContainerServiceAgentPoolData 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(ContainerServiceAgentPoolData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceAgentPoolData(document.RootElement, options); - } - - internal static ContainerServiceAgentPoolData DeserializeContainerServiceAgentPoolData(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; - int? count = default; - string vmSize = default; - int? osDiskSizeGB = default; - ContainerServiceOSDiskType? osDiskType = default; - KubeletDiskType? kubeletDiskType = default; - WorkloadRuntime? workloadRuntime = default; - ResourceIdentifier vnetSubnetId = default; - ResourceIdentifier podSubnetId = default; - int? maxPods = default; - ContainerServiceOSType? osType = default; - ContainerServiceOSSku? osSku = default; - int? maxCount = default; - int? minCount = default; - bool? enableAutoScaling = default; - ScaleDownMode? scaleDownMode = default; - AgentPoolType? type0 = default; - AgentPoolMode? mode = default; - string orchestratorVersion = default; - string currentOrchestratorVersion = default; - string nodeImageVersion = default; - AgentPoolUpgradeSettings upgradeSettings = default; - string provisioningState = default; - ContainerServicePowerState powerState = default; - IList availabilityZones = default; - bool? enableNodePublicIP = default; - ResourceIdentifier nodePublicIPPrefixId = default; - ScaleSetPriority? scaleSetPriority = default; - ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; - float? spotMaxPrice = default; - IDictionary tags = default; - IDictionary nodeLabels = default; - IList nodeTaints = default; - ResourceIdentifier proximityPlacementGroupId = default; - KubeletConfig kubeletConfig = default; - LinuxOSConfig linuxOSConfig = default; - bool? enableEncryptionAtHost = default; - bool? enableUltraSsd = default; - bool? enableFIPS = default; - GpuInstanceProfile? gpuInstanceProfile = default; - ContainerServiceCreationData creationData = default; - ResourceIdentifier capacityReservationGroupId = default; - ResourceIdentifier hostGroupId = default; - AgentPoolNetworkProfile networkProfile = 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("count"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("vmSize"u8)) - { - vmSize = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("osDiskSizeGB"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskSizeGB = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("osDiskType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskType = new ContainerServiceOSDiskType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("kubeletDiskType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletDiskType = new KubeletDiskType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("workloadRuntime"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - workloadRuntime = new WorkloadRuntime(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("vnetSubnetID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vnetSubnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("podSubnetID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - podSubnetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("maxPods"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxPods = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("osType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osType = new ContainerServiceOSType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("osSKU"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osSku = new ContainerServiceOSSku(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("maxCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("minCount"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minCount = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("enableAutoScaling"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableAutoScaling = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("scaleDownMode"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleDownMode = new ScaleDownMode(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("type"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type0 = new AgentPoolType(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("mode"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mode = new AgentPoolMode(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("orchestratorVersion"u8)) - { - orchestratorVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("currentOrchestratorVersion"u8)) - { - currentOrchestratorVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("nodeImageVersion"u8)) - { - nodeImageVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("upgradeSettings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - upgradeSettings = AgentPoolUpgradeSettings.DeserializeAgentPoolUpgradeSettings(property0.Value, options); - continue; - } - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("powerState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - powerState = ContainerServicePowerState.DeserializeContainerServicePowerState(property0.Value, options); - continue; - } - if (property0.NameEquals("availabilityZones"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - availabilityZones = array; - continue; - } - if (property0.NameEquals("enableNodePublicIP"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNodePublicIP = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("nodePublicIPPrefixID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nodePublicIPPrefixId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("scaleSetPriority"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetPriority = new ScaleSetPriority(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("scaleSetEvictionPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetEvictionPolicy = new ScaleSetEvictionPolicy(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("spotMaxPrice"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - spotMaxPrice = property0.Value.GetSingle(); - continue; - } - if (property0.NameEquals("tags"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - tags = dictionary; - continue; - } - if (property0.NameEquals("nodeLabels"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, property1.Value.GetString()); - } - nodeLabels = dictionary; - continue; - } - if (property0.NameEquals("nodeTaints"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - nodeTaints = array; - continue; - } - if (property0.NameEquals("proximityPlacementGroupID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - proximityPlacementGroupId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("kubeletConfig"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletConfig = KubeletConfig.DeserializeKubeletConfig(property0.Value, options); - continue; - } - if (property0.NameEquals("linuxOSConfig"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linuxOSConfig = LinuxOSConfig.DeserializeLinuxOSConfig(property0.Value, options); - continue; - } - if (property0.NameEquals("enableEncryptionAtHost"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableEncryptionAtHost = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("enableUltraSSD"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableUltraSsd = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("enableFIPS"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableFIPS = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("gpuInstanceProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gpuInstanceProfile = new GpuInstanceProfile(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("creationData"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationData = ContainerServiceCreationData.DeserializeContainerServiceCreationData(property0.Value, options); - continue; - } - if (property0.NameEquals("capacityReservationGroupID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityReservationGroupId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("hostGroupID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hostGroupId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("networkProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property0.Value, options); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceAgentPoolData( - id, - name, - type, - systemData, - count, - vmSize, - osDiskSizeGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - type0, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, - provisioningState, - powerState, - availabilityZones ?? new ChangeTrackingList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags ?? new ChangeTrackingDictionary(), - nodeLabels ?? new ChangeTrackingDictionary(), - nodeTaints ?? new ChangeTrackingList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFIPS, - gpuInstanceProfile, - creationData, - capacityReservationGroupId, - hostGroupId, - 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(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(Count), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Count)) - { - builder.Append(" count: "); - builder.AppendLine($"{Count.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSize), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmSize: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmSize)) - { - builder.Append(" vmSize: "); - if (VmSize.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{VmSize}'''"); - } - else - { - builder.AppendLine($"'{VmSize}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskSizeInGB), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskSizeInGB)) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine($"{OSDiskSizeInGB.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskType)) - { - builder.Append(" osDiskType: "); - builder.AppendLine($"'{OSDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletDiskType)) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine($"'{KubeletDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WorkloadRuntime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(WorkloadRuntime)) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine($"'{WorkloadRuntime.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VnetSubnetId)) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine($"'{VnetSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodSubnetId)) - { - builder.Append(" podSubnetID: "); - builder.AppendLine($"'{PodSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxPods: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxPods)) - { - builder.Append(" maxPods: "); - builder.AppendLine($"{MaxPods.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSType)) - { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSSku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osSKU: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSSku)) - { - builder.Append(" osSKU: "); - builder.AppendLine($"'{OSSku.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxCount)) - { - builder.Append(" maxCount: "); - builder.AppendLine($"{MaxCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" minCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MinCount)) - { - builder.Append(" minCount: "); - builder.AppendLine($"{MinCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableAutoScaling), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableAutoScaling: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableAutoScaling)) - { - builder.Append(" enableAutoScaling: "); - var boolValue = EnableAutoScaling.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownMode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownMode)) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine($"'{ScaleDownMode.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TypePropertiesType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" type: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TypePropertiesType)) - { - builder.Append(" type: "); - builder.AppendLine($"'{TypePropertiesType.Value.ToString()}'"); - } - } - - 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(OrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" orchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OrchestratorVersion)) - { - builder.Append(" orchestratorVersion: "); - if (OrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{OrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurrentOrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" currentOrchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CurrentOrchestratorVersion)) - { - builder.Append(" currentOrchestratorVersion: "); - if (CurrentOrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CurrentOrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{CurrentOrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeImageVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeImageVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeImageVersion)) - { - builder.Append(" nodeImageVersion: "); - if (NodeImageVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NodeImageVersion}'''"); - } - else - { - builder.AppendLine($"'{NodeImageVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeSettings), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgradeSettings: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UpgradeSettings)) - { - builder.Append(" upgradeSettings: "); - BicepSerializationHelpers.AppendChildObject(builder, UpgradeSettings, options, 4, false, " upgradeSettings: "); - } - } - - 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}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PowerStateCode", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" powerState: "); - builder.AppendLine("{"); - builder.AppendLine(" powerState: {"); - builder.Append(" code: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PowerState)) - { - builder.Append(" powerState: "); - BicepSerializationHelpers.AppendChildObject(builder, PowerState, options, 4, false, " powerState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailabilityZones), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" availabilityZones: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AvailabilityZones)) - { - if (AvailabilityZones.Any()) - { - builder.Append(" availabilityZones: "); - builder.AppendLine("["); - foreach (var item in AvailabilityZones) - { - 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(EnableNodePublicIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableNodePublicIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableNodePublicIP)) - { - builder.Append(" enableNodePublicIP: "); - var boolValue = EnableNodePublicIP.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodePublicIPPrefixId)) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine($"'{NodePublicIPPrefixId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetPriority), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetPriority)) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine($"'{ScaleSetPriority.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetEvictionPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetEvictionPolicy)) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine($"'{ScaleSetEvictionPolicy.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SpotMaxPrice), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SpotMaxPrice)) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine($"'{SpotMaxPrice.Value.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(NodeLabels), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeLabels: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeLabels)) - { - if (NodeLabels.Any()) - { - builder.Append(" nodeLabels: "); - builder.AppendLine("{"); - foreach (var item in NodeLabels) - { - 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(NodeTaints), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeTaints: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeTaints)) - { - if (NodeTaints.Any()) - { - builder.Append(" nodeTaints: "); - builder.AppendLine("["); - foreach (var item in NodeTaints) - { - 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) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine($"'{ProximityPlacementGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletConfig)) - { - builder.Append(" kubeletConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, KubeletConfig, options, 4, false, " kubeletConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinuxOSConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linuxOSConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinuxOSConfig)) - { - builder.Append(" linuxOSConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, LinuxOSConfig, options, 4, false, " linuxOSConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableEncryptionAtHost), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableEncryptionAtHost: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableEncryptionAtHost)) - { - builder.Append(" enableEncryptionAtHost: "); - var boolValue = EnableEncryptionAtHost.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableUltraSsd), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableUltraSSD: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableUltraSsd)) - { - builder.Append(" enableUltraSSD: "); - var boolValue = EnableUltraSsd.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFips), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableFIPS: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableFips)) - { - builder.Append(" enableFIPS: "); - var boolValue = EnableFips.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuInstanceProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GpuInstanceProfile)) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine($"'{GpuInstanceProfile.Value.ToString()}'"); - } - } - - 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(CapacityReservationGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CapacityReservationGroupId)) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine($"'{CapacityReservationGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hostGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HostGroupId)) - { - builder.Append(" hostGroupID: "); - builder.AppendLine($"'{HostGroupId.ToString()}'"); - } - } - - 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, 4, false, " networkProfile: "); - } - } - - 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(ContainerServiceAgentPoolData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceAgentPoolData 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); - return DeserializeContainerServiceAgentPoolData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceAgentPoolData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs deleted file mode 100644 index d21fe3381f1a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolData.cs +++ /dev/null @@ -1,314 +0,0 @@ -// 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 ContainerServiceAgentPool data model. - /// Agent Pool. - /// - public partial class ContainerServiceAgentPoolData : 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 ContainerServiceAgentPoolData() - { - AvailabilityZones = new ChangeTrackingList(); - Tags = new ChangeTrackingDictionary(); - NodeLabels = new ChangeTrackingDictionary(); - NodeTaints = new ChangeTrackingList(); - } - - /// 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. - /// 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) - { - Count = count; - VmSize = vmSize; - OSDiskSizeInGB = osDiskSizeInGB; - OSDiskType = osDiskType; - KubeletDiskType = kubeletDiskType; - WorkloadRuntime = workloadRuntime; - VnetSubnetId = vnetSubnetId; - PodSubnetId = podSubnetId; - 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; - PowerState = powerState; - AvailabilityZones = availabilityZones; - EnableNodePublicIP = enableNodePublicIP; - NodePublicIPPrefixId = nodePublicIPPrefixId; - ScaleSetPriority = scaleSetPriority; - ScaleSetEvictionPolicy = scaleSetEvictionPolicy; - SpotMaxPrice = spotMaxPrice; - Tags = tags; - NodeLabels = nodeLabels; - NodeTaints = nodeTaints; - ProximityPlacementGroupId = proximityPlacementGroupId; - KubeletConfig = kubeletConfig; - LinuxOSConfig = linuxOSConfig; - EnableEncryptionAtHost = enableEncryptionAtHost; - EnableUltraSsd = enableUltraSsd; - EnableFips = enableFips; - GpuInstanceProfile = gpuInstanceProfile; - CreationData = creationData; - CapacityReservationGroupId = capacityReservationGroupId; - HostGroupId = hostGroupId; - NetworkProfile = networkProfile; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// 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; } - /// 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. - [WirePath("properties.vmSize")] - public string VmSize { get; set; } - /// 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. - [WirePath("properties.osDiskSizeGB")] - public int? OSDiskSizeInGB { get; set; } - /// 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). - [WirePath("properties.osDiskType")] - public ContainerServiceOSDiskType? OSDiskType { get; set; } - /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. - [WirePath("properties.kubeletDiskType")] - public KubeletDiskType? KubeletDiskType { get; set; } - /// Determines the type of workload a node can run. - [WirePath("properties.workloadRuntime")] - public WorkloadRuntime? WorkloadRuntime { 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 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. - [WirePath("properties.osSKU")] - public ContainerServiceOSSku? OSSku { get; set; } - /// The maximum number of nodes for auto-scaling. - [WirePath("properties.maxCount")] - public int? MaxCount { get; set; } - /// The minimum number of nodes for auto-scaling. - [WirePath("properties.minCount")] - public int? MinCount { get; set; } - /// Whether to enable auto-scaler. - [WirePath("properties.enableAutoScaling")] - public bool? EnableAutoScaling { get; set; } - /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. - [WirePath("properties.scaleDownMode")] - public ScaleDownMode? ScaleDownMode { get; set; } - /// The type of Agent Pool. - [WirePath("properties.type")] - public AgentPoolType? TypePropertiesType { get; set; } - /// 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). - [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. - [WirePath("properties.currentOrchestratorVersion")] - public string CurrentOrchestratorVersion { get; } - /// The version of node image. - [WirePath("properties.nodeImageVersion")] - public string NodeImageVersion { get; } - /// Settings for upgrading the agentpool. - [WirePath("properties.upgradeSettings")] - public AgentPoolUpgradeSettings UpgradeSettings { get; set; } - /// The current deployment or provisioning state. - [WirePath("properties.provisioningState")] - public string ProvisioningState { get; } - /// 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. - internal ContainerServicePowerState PowerState { get; set; } - /// Tells whether the cluster is Running or Stopped. - [WirePath("properties.powerState.code")] - public ContainerServiceStateCode? PowerStateCode - { - get => PowerState is null ? default : PowerState.Code; - set - { - if (PowerState is null) - PowerState = new ContainerServicePowerState(); - PowerState.Code = value; - } - } - - /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. - [WirePath("properties.availabilityZones")] - public IList AvailabilityZones { get; } - /// 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; } - /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. - [WirePath("properties.nodePublicIPPrefixID")] - public ResourceIdentifier NodePublicIPPrefixId { get; set; } - /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. - [WirePath("properties.scaleSetPriority")] - public ScaleSetPriority? ScaleSetPriority { get; set; } - /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. - [WirePath("properties.scaleSetEvictionPolicy")] - public ScaleSetEvictionPolicy? ScaleSetEvictionPolicy { get; set; } - /// 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). - [WirePath("properties.spotMaxPrice")] - public float? SpotMaxPrice { get; set; } - /// The tags to be persisted on the agent pool virtual machine scale set. - [WirePath("properties.tags")] - public IDictionary Tags { get; } - /// The node labels to be persisted across all nodes in agent pool. - [WirePath("properties.nodeLabels")] - public IDictionary NodeLabels { get; } - /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - [WirePath("properties.nodeTaints")] - public IList NodeTaints { get; } - /// The ID for Proximity Placement Group. - [WirePath("properties.proximityPlacementGroupID")] - public ResourceIdentifier ProximityPlacementGroupId { get; set; } - /// The Kubelet configuration on the agent pool nodes. - [WirePath("properties.kubeletConfig")] - public KubeletConfig KubeletConfig { get; set; } - /// The OS configuration of Linux agent nodes. - [WirePath("properties.linuxOSConfig")] - public LinuxOSConfig LinuxOSConfig { get; set; } - /// 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. - [WirePath("properties.enableEncryptionAtHost")] - public bool? EnableEncryptionAtHost { get; set; } - /// Whether to enable UltraSSD. - [WirePath("properties.enableUltraSSD")] - public bool? EnableUltraSsd { get; set; } - /// 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. - [WirePath("properties.enableFIPS")] - public bool? EnableFips { get; set; } - /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - [WirePath("properties.gpuInstanceProfile")] - public GpuInstanceProfile? GpuInstanceProfile { get; set; } - /// CreationData to be used to specify the source Snapshot ID if the node pool 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; - } - } - - /// AKS will associate the specified agent pool with the Capacity Reservation Group. - [WirePath("properties.capacityReservationGroupID")] - public ResourceIdentifier CapacityReservationGroupId { get; set; } - /// 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; } - /// Network-related settings of an agent pool. - [WirePath("properties.networkProfile")] - public AgentPoolNetworkProfile NetworkProfile { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.Serialization.cs deleted file mode 100644 index c96ca2cec37b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.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 ContainerServiceAgentPoolResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ContainerServiceAgentPoolData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ContainerServiceAgentPoolData 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/ContainerServiceAgentPoolResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs deleted file mode 100644 index e3ed5337ca43..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceAgentPoolResource.cs +++ /dev/null @@ -1,859 +0,0 @@ -// 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; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A Class representing a ContainerServiceAgentPool 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 GetContainerServiceAgentPoolResource method. - /// Otherwise you can get one from its parent resource using the GetContainerServiceAgentPool method. - /// - public partial class ContainerServiceAgentPoolResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The resourceName. - /// The agentPoolName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _containerServiceAgentPoolAgentPoolsClientDiagnostics; - private readonly AgentPoolsRestOperations _containerServiceAgentPoolAgentPoolsRestClient; - private readonly ContainerServiceAgentPoolData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/agentPools"; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceAgentPoolResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal ContainerServiceAgentPoolResource(ArmClient client, ContainerServiceAgentPoolData 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 ContainerServiceAgentPoolResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceAgentPoolAgentPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string containerServiceAgentPoolAgentPoolsApiVersion); - _containerServiceAgentPoolAgentPoolsRestClient = new AgentPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceAgentPoolAgentPoolsApiVersion); -#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 ContainerServiceAgentPoolData 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 an object representing a AgentPoolUpgradeProfileResource along with the instance operations that can be performed on it in the ContainerServiceAgentPool. - /// Returns a object. - public virtual AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfile() - { - return new AgentPoolUpgradeProfileResource(Client, Id.AppendChildResource("upgradeProfiles", "default")); - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Get"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.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 ContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Get"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Delete - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Deletes an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Delete - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates or updates an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 agent pool to create or update. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Update"); - 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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Creates or updates an agent pool in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 agent pool to create or update. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceAgentPoolData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.Update"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort - /// - /// - /// Operation Id - /// AgentPools_AbortLatestOperation - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AbortLatestOperationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.AbortLatestOperation"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.AbortLatestOperationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateAbortLatestOperationRequest(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; - } - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/agentPools/{agentPoolName}/abort - /// - /// - /// Operation Id - /// AgentPools_AbortLatestOperation - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AbortLatestOperation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.AbortLatestOperation"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.AbortLatestOperation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateAbortLatestOperationRequest(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; - } - } - - /// - /// 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 - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion - /// - /// - /// Operation Id - /// AgentPools_UpgradeNodeImageVersion - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 UpgradeNodeImageVersionAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.UpgradeNodeImageVersion"); - scope.Start(); - try - { - var response = await _containerServiceAgentPoolAgentPoolsRestClient.UpgradeNodeImageVersionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateUpgradeNodeImageVersionRequest(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; - } - } - - /// - /// 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 - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName}/upgradeNodeImageVersion - /// - /// - /// Operation Id - /// AgentPools_UpgradeNodeImageVersion - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 UpgradeNodeImageVersion(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.UpgradeNodeImageVersion"); - scope.Start(); - try - { - var response = _containerServiceAgentPoolAgentPoolsRestClient.UpgradeNodeImageVersion(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceAgentPoolAgentPoolsClientDiagnostics, Pipeline, _containerServiceAgentPoolAgentPoolsRestClient.CreateUpgradeNodeImageVersionRequest(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; - } - } - - /// - /// Add a tag to the current resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - current.Tags[key] = value; - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - current.Tags[key] = value; - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - current.Tags.ReplaceWith(tags); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - current.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 _containerServiceAgentPoolAgentPoolsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; - current.Tags.Remove(key); - var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceAgentPoolAgentPoolsClientDiagnostics.CreateScope("ContainerServiceAgentPoolResource.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 = _containerServiceAgentPoolAgentPoolsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceAgentPoolResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - current.Tags.Remove(key); - var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs deleted file mode 100644 index f608a529017b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationCollection.cs +++ /dev/null @@ -1,497 +0,0 @@ -// 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 GetContainerServiceMaintenanceConfigurations method from an instance of . - /// - public partial class ContainerServiceMaintenanceConfigurationCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics; - private readonly MaintenanceConfigurationsRestOperations _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceMaintenanceConfigurationCollection() - { - } - - /// 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 ContainerServiceMaintenanceConfigurationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceMaintenanceConfigurationResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ContainerServiceMaintenanceConfigurationResource.ResourceType, out string containerServiceMaintenanceConfigurationMaintenanceConfigurationsApiVersion); - _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient = new MaintenanceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceMaintenanceConfigurationMaintenanceConfigurationsApiVersion); -#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 maintenance configuration in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 maintenance configuration. - /// The maintenance configuration 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 configName, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, data, cancellationToken).ConfigureAwait(false); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(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 maintenance configuration in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 maintenance configuration. - /// The maintenance configuration 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 configName, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, data, cancellationToken); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified maintenance configuration of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.Get"); - scope.Start(); - try - { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the specified maintenance configuration of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.Get"); - scope.Start(); - try - { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of maintenance configurations in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations - /// - /// - /// Operation Id - /// MaintenanceConfigurations_ListByManagedCluster - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of maintenance configurations in the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations - /// - /// - /// Operation Id - /// MaintenanceConfigurations_ListByManagedCluster - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateListByManagedClusterNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceMaintenanceConfigurationResource(Client, ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(e)), _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics, Pipeline, "ContainerServiceMaintenanceConfigurationCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.Exists"); - scope.Start(); - try - { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, 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}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.Exists"); - scope.Start(); - try - { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, 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}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(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}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string configName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); - - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationCollection.GetIfExists"); - scope.Start(); - try - { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, configName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(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/ContainerServiceMaintenanceConfigurationData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs deleted file mode 100644 index 61da83c4dce3..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationData.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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 ContainerServiceMaintenanceConfiguration data model. - /// See [planned maintenance](https://docs.microsoft.com/azure/aks/planned-maintenance) for more information about planned maintenance. - /// - public partial class ContainerServiceMaintenanceConfigurationData : 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 ContainerServiceMaintenanceConfigurationData() - { - TimesInWeek = new ChangeTrackingList(); - NotAllowedTimes = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. - /// Time slots on which upgrade is not allowed. - /// Maintenance window for the maintenance configuration. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IList timesInWeek, IList notAllowedTimes, ContainerServiceMaintenanceWindow maintenanceWindow, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - TimesInWeek = timesInWeek; - NotAllowedTimes = notAllowedTimes; - MaintenanceWindow = maintenanceWindow; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// If two array entries specify the same day of the week, the applied configuration is the union of times in both entries. - [WirePath("properties.timeInWeek")] - public IList TimesInWeek { get; } - /// Time slots on which upgrade is not allowed. - [WirePath("properties.notAllowedTime")] - public IList NotAllowedTimes { get; } - /// Maintenance window for the maintenance configuration. - [WirePath("properties.maintenanceWindow")] - public ContainerServiceMaintenanceWindow MaintenanceWindow { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.Serialization.cs deleted file mode 100644 index 27789b642a4d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.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 ContainerServiceMaintenanceConfigurationResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ContainerServiceMaintenanceConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ContainerServiceMaintenanceConfigurationData 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/ContainerServiceManagedClusterCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs deleted file mode 100644 index a05f8d6c2d6d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterCollection.cs +++ /dev/null @@ -1,494 +0,0 @@ -// 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 GetContainerServiceManagedClusters method from an instance of . - /// - public partial class ContainerServiceManagedClusterCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceManagedClusterCollection() - { - } - - /// 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 ContainerServiceManagedClusterCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceManagedClusterManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceManagedClusterResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ContainerServiceManagedClusterResource.ResourceType, out string containerServiceManagedClusterManagedClustersApiVersion); - _containerServiceManagedClusterManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceManagedClusterManagedClustersApiVersion); -#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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 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, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.CreateOrUpdate"); - 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); - 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 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, ContainerServiceManagedClusterData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.CreateOrUpdate"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.Get"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.Get"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists managed clusters in the specified subscription and resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists managed clusters in the specified subscription and resource group. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_ListByResourceGroup - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.Exists"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.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/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.Exists"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.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/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterCollection.GetIfExists"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, resourceName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(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/ContainerServiceManagedClusterData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs deleted file mode 100644 index c9542e97356d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.Serialization.cs +++ /dev/null @@ -1,1734 +0,0 @@ -// 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; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService -{ - public partial class ContainerServiceManagedClusterData : 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(ContainerServiceManagedClusterData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Sku)) - { - writer.WritePropertyName("sku"u8); - writer.WriteObjectValue(Sku, options); - } - if (Optional.IsDefined(ExtendedLocation)) - { - writer.WritePropertyName("extendedLocation"u8); - JsonSerializer.Serialize(writer, ExtendedLocation); - } - if (Optional.IsDefined(ClusterIdentity)) - { - writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(ClusterIdentity, options); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(PowerState)) - { - writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState, options); - } - if (options.Format != "W" && Optional.IsDefined(MaxAgentPools)) - { - writer.WritePropertyName("maxAgentPools"u8); - writer.WriteNumberValue(MaxAgentPools.Value); - } - if (Optional.IsDefined(KubernetesVersion)) - { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - } - if (options.Format != "W" && Optional.IsDefined(CurrentKubernetesVersion)) - { - writer.WritePropertyName("currentKubernetesVersion"u8); - writer.WriteStringValue(CurrentKubernetesVersion); - } - if (Optional.IsDefined(DnsPrefix)) - { - writer.WritePropertyName("dnsPrefix"u8); - writer.WriteStringValue(DnsPrefix); - } - if (Optional.IsDefined(FqdnSubdomain)) - { - writer.WritePropertyName("fqdnSubdomain"u8); - writer.WriteStringValue(FqdnSubdomain); - } - if (options.Format != "W" && Optional.IsDefined(Fqdn)) - { - writer.WritePropertyName("fqdn"u8); - writer.WriteStringValue(Fqdn); - } - if (options.Format != "W" && Optional.IsDefined(PrivateFqdn)) - { - writer.WritePropertyName("privateFQDN"u8); - writer.WriteStringValue(PrivateFqdn); - } - if (options.Format != "W" && Optional.IsDefined(AzurePortalFqdn)) - { - writer.WritePropertyName("azurePortalFQDN"u8); - writer.WriteStringValue(AzurePortalFqdn); - } - if (Optional.IsCollectionDefined(AgentPoolProfiles)) - { - writer.WritePropertyName("agentPoolProfiles"u8); - writer.WriteStartArray(); - foreach (var item in AgentPoolProfiles) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(LinuxProfile)) - { - writer.WritePropertyName("linuxProfile"u8); - writer.WriteObjectValue(LinuxProfile, options); - } - if (Optional.IsDefined(WindowsProfile)) - { - writer.WritePropertyName("windowsProfile"u8); - writer.WriteObjectValue(WindowsProfile, options); - } - if (Optional.IsDefined(ServicePrincipalProfile)) - { - writer.WritePropertyName("servicePrincipalProfile"u8); - writer.WriteObjectValue(ServicePrincipalProfile, options); - } - if (Optional.IsCollectionDefined(AddonProfiles)) - { - writer.WritePropertyName("addonProfiles"u8); - writer.WriteStartObject(); - foreach (var item in AddonProfiles) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value, options); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(PodIdentityProfile)) - { - writer.WritePropertyName("podIdentityProfile"u8); - writer.WriteObjectValue(PodIdentityProfile, options); - } - if (Optional.IsDefined(OidcIssuerProfile)) - { - writer.WritePropertyName("oidcIssuerProfile"u8); - writer.WriteObjectValue(OidcIssuerProfile, options); - } - if (Optional.IsDefined(NodeResourceGroup)) - { - writer.WritePropertyName("nodeResourceGroup"u8); - writer.WriteStringValue(NodeResourceGroup); - } - if (Optional.IsDefined(EnableRbac)) - { - writer.WritePropertyName("enableRBAC"u8); - writer.WriteBooleanValue(EnableRbac.Value); - } - if (Optional.IsDefined(SupportPlan)) - { - writer.WritePropertyName("supportPlan"u8); - writer.WriteStringValue(SupportPlan.Value.ToString()); - } - if (Optional.IsDefined(EnablePodSecurityPolicy)) - { - writer.WritePropertyName("enablePodSecurityPolicy"u8); - writer.WriteBooleanValue(EnablePodSecurityPolicy.Value); - } - if (Optional.IsDefined(NetworkProfile)) - { - writer.WritePropertyName("networkProfile"u8); - writer.WriteObjectValue(NetworkProfile, options); - } - if (Optional.IsDefined(AadProfile)) - { - writer.WritePropertyName("aadProfile"u8); - writer.WriteObjectValue(AadProfile, options); - } - if (Optional.IsDefined(AutoUpgradeProfile)) - { - writer.WritePropertyName("autoUpgradeProfile"u8); - writer.WriteObjectValue(AutoUpgradeProfile, options); - } - if (Optional.IsDefined(UpgradeSettings)) - { - writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings, options); - } - if (Optional.IsDefined(AutoScalerProfile)) - { - writer.WritePropertyName("autoScalerProfile"u8); - writer.WriteObjectValue(AutoScalerProfile, options); - } - if (Optional.IsDefined(ApiServerAccessProfile)) - { - writer.WritePropertyName("apiServerAccessProfile"u8); - writer.WriteObjectValue(ApiServerAccessProfile, options); - } - if (Optional.IsDefined(DiskEncryptionSetId)) - { - writer.WritePropertyName("diskEncryptionSetID"u8); - writer.WriteStringValue(DiskEncryptionSetId); - } - if (Optional.IsCollectionDefined(IdentityProfile)) - { - writer.WritePropertyName("identityProfile"u8); - writer.WriteStartObject(); - foreach (var item in IdentityProfile) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value, options); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(PrivateLinkResources)) - { - writer.WritePropertyName("privateLinkResources"u8); - writer.WriteStartArray(); - foreach (var item in PrivateLinkResources) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(DisableLocalAccounts)) - { - writer.WritePropertyName("disableLocalAccounts"u8); - writer.WriteBooleanValue(DisableLocalAccounts.Value); - } - if (Optional.IsDefined(HttpProxyConfig)) - { - writer.WritePropertyName("httpProxyConfig"u8); - writer.WriteObjectValue(HttpProxyConfig, options); - } - if (Optional.IsDefined(SecurityProfile)) - { - writer.WritePropertyName("securityProfile"u8); - writer.WriteObjectValue(SecurityProfile, options); - } - if (Optional.IsDefined(StorageProfile)) - { - writer.WritePropertyName("storageProfile"u8); - writer.WriteObjectValue(StorageProfile, options); - } - if (Optional.IsDefined(PublicNetworkAccess)) - { - writer.WritePropertyName("publicNetworkAccess"u8); - writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); - } - if (Optional.IsDefined(WorkloadAutoScalerProfile)) - { - writer.WritePropertyName("workloadAutoScalerProfile"u8); - writer.WriteObjectValue(WorkloadAutoScalerProfile, options); - } - if (Optional.IsDefined(AzureMonitorProfile)) - { - writer.WritePropertyName("azureMonitorProfile"u8); - writer.WriteObjectValue(AzureMonitorProfile, options); - } - if (Optional.IsDefined(ServiceMeshProfile)) - { - writer.WritePropertyName("serviceMeshProfile"u8); - writer.WriteObjectValue(ServiceMeshProfile, options); - } - if (options.Format != "W" && Optional.IsDefined(ResourceId)) - { - writer.WritePropertyName("resourceUID"u8); - writer.WriteStringValue(ResourceId); - } - writer.WriteEndObject(); - } - - ContainerServiceManagedClusterData 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(ContainerServiceManagedClusterData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceManagedClusterData(document.RootElement, options); - } - - internal static ContainerServiceManagedClusterData DeserializeContainerServiceManagedClusterData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterSku sku = default; - ExtendedLocation extendedLocation = default; - ManagedClusterIdentity identity = default; - IDictionary tags = default; - AzureLocation location = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; - string provisioningState = default; - ContainerServicePowerState powerState = default; - int? maxAgentPools = default; - string kubernetesVersion = default; - string currentKubernetesVersion = default; - string dnsPrefix = default; - string fqdnSubdomain = default; - string fqdn = default; - string privateFQDN = default; - string azurePortalFQDN = default; - IList agentPoolProfiles = default; - ContainerServiceLinuxProfile linuxProfile = default; - ManagedClusterWindowsProfile windowsProfile = default; - ManagedClusterServicePrincipalProfile servicePrincipalProfile = default; - IDictionary addonProfiles = default; - ManagedClusterPodIdentityProfile podIdentityProfile = default; - ManagedClusterOidcIssuerProfile oidcIssuerProfile = default; - string nodeResourceGroup = default; - bool? enableRBAC = default; - KubernetesSupportPlan? supportPlan = default; - bool? enablePodSecurityPolicy = default; - ContainerServiceNetworkProfile networkProfile = default; - ManagedClusterAadProfile aadProfile = default; - ManagedClusterAutoUpgradeProfile autoUpgradeProfile = default; - ClusterUpgradeSettings upgradeSettings = default; - ManagedClusterAutoScalerProfile autoScalerProfile = default; - ManagedClusterApiServerAccessProfile apiServerAccessProfile = default; - ResourceIdentifier diskEncryptionSetId = default; - IDictionary identityProfile = default; - IList privateLinkResources = default; - bool? disableLocalAccounts = default; - ManagedClusterHttpProxyConfig httpProxyConfig = default; - ManagedClusterSecurityProfile securityProfile = default; - ManagedClusterStorageProfile storageProfile = default; - ContainerServicePublicNetworkAccess? publicNetworkAccess = default; - ManagedClusterWorkloadAutoScalerProfile workloadAutoScalerProfile = default; - ManagedClusterAzureMonitorProfile azureMonitorProfile = default; - ServiceMeshProfile serviceMeshProfile = default; - ResourceIdentifier resourceUID = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sku = ManagedClusterSku.DeserializeManagedClusterSku(property.Value, options); - continue; - } - if (property.NameEquals("extendedLocation"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ManagedClusterIdentity.DeserializeManagedClusterIdentity(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 (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("powerState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - powerState = ContainerServicePowerState.DeserializeContainerServicePowerState(property0.Value, options); - continue; - } - if (property0.NameEquals("maxAgentPools"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxAgentPools = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("kubernetesVersion"u8)) - { - kubernetesVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("currentKubernetesVersion"u8)) - { - currentKubernetesVersion = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("dnsPrefix"u8)) - { - dnsPrefix = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("fqdnSubdomain"u8)) - { - fqdnSubdomain = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("fqdn"u8)) - { - fqdn = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("privateFQDN"u8)) - { - privateFQDN = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("azurePortalFQDN"u8)) - { - azurePortalFQDN = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("agentPoolProfiles"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ManagedClusterAgentPoolProfile.DeserializeManagedClusterAgentPoolProfile(item, options)); - } - agentPoolProfiles = array; - continue; - } - if (property0.NameEquals("linuxProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linuxProfile = ContainerServiceLinuxProfile.DeserializeContainerServiceLinuxProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("windowsProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - windowsProfile = ManagedClusterWindowsProfile.DeserializeManagedClusterWindowsProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("servicePrincipalProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - servicePrincipalProfile = ManagedClusterServicePrincipalProfile.DeserializeManagedClusterServicePrincipalProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("addonProfiles"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, ManagedClusterAddonProfile.DeserializeManagedClusterAddonProfile(property1.Value, options)); - } - addonProfiles = dictionary; - continue; - } - if (property0.NameEquals("podIdentityProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - podIdentityProfile = ManagedClusterPodIdentityProfile.DeserializeManagedClusterPodIdentityProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("oidcIssuerProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - oidcIssuerProfile = ManagedClusterOidcIssuerProfile.DeserializeManagedClusterOidcIssuerProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("nodeResourceGroup"u8)) - { - nodeResourceGroup = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("enableRBAC"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableRBAC = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("supportPlan"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - supportPlan = new KubernetesSupportPlan(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("enablePodSecurityPolicy"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enablePodSecurityPolicy = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("networkProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkProfile = ContainerServiceNetworkProfile.DeserializeContainerServiceNetworkProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("aadProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - aadProfile = ManagedClusterAadProfile.DeserializeManagedClusterAadProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("autoUpgradeProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - autoUpgradeProfile = ManagedClusterAutoUpgradeProfile.DeserializeManagedClusterAutoUpgradeProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("upgradeSettings"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - upgradeSettings = ClusterUpgradeSettings.DeserializeClusterUpgradeSettings(property0.Value, options); - continue; - } - if (property0.NameEquals("autoScalerProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - autoScalerProfile = ManagedClusterAutoScalerProfile.DeserializeManagedClusterAutoScalerProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("apiServerAccessProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - apiServerAccessProfile = ManagedClusterApiServerAccessProfile.DeserializeManagedClusterApiServerAccessProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("diskEncryptionSetID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskEncryptionSetId = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("identityProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property1 in property0.Value.EnumerateObject()) - { - dictionary.Add(property1.Name, ContainerServiceUserAssignedIdentity.DeserializeContainerServiceUserAssignedIdentity(property1.Value, options)); - } - identityProfile = dictionary; - continue; - } - if (property0.NameEquals("privateLinkResources"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(item, options)); - } - privateLinkResources = array; - continue; - } - if (property0.NameEquals("disableLocalAccounts"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disableLocalAccounts = property0.Value.GetBoolean(); - continue; - } - if (property0.NameEquals("httpProxyConfig"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - httpProxyConfig = ManagedClusterHttpProxyConfig.DeserializeManagedClusterHttpProxyConfig(property0.Value, options); - continue; - } - if (property0.NameEquals("securityProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - securityProfile = ManagedClusterSecurityProfile.DeserializeManagedClusterSecurityProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("storageProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - storageProfile = ManagedClusterStorageProfile.DeserializeManagedClusterStorageProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("publicNetworkAccess"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - publicNetworkAccess = new ContainerServicePublicNetworkAccess(property0.Value.GetString()); - continue; - } - if (property0.NameEquals("workloadAutoScalerProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - workloadAutoScalerProfile = ManagedClusterWorkloadAutoScalerProfile.DeserializeManagedClusterWorkloadAutoScalerProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("azureMonitorProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - azureMonitorProfile = ManagedClusterAzureMonitorProfile.DeserializeManagedClusterAzureMonitorProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("serviceMeshProfile"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serviceMeshProfile = ServiceMeshProfile.DeserializeServiceMeshProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("resourceUID"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceUID = new ResourceIdentifier(property0.Value.GetString()); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceManagedClusterData( - id, - name, - type, - systemData, - tags ?? new ChangeTrackingDictionary(), - location, - sku, - extendedLocation, - identity, - provisioningState, - powerState, - maxAgentPools, - kubernetesVersion, - currentKubernetesVersion, - dnsPrefix, - fqdnSubdomain, - fqdn, - privateFQDN, - azurePortalFQDN, - agentPoolProfiles ?? new ChangeTrackingList(), - linuxProfile, - windowsProfile, - servicePrincipalProfile, - addonProfiles ?? new ChangeTrackingDictionary(), - podIdentityProfile, - oidcIssuerProfile, - nodeResourceGroup, - enableRBAC, - supportPlan, - enablePodSecurityPolicy, - networkProfile, - aadProfile, - autoUpgradeProfile, - upgradeSettings, - autoScalerProfile, - apiServerAccessProfile, - diskEncryptionSetId, - identityProfile ?? new ChangeTrackingDictionary(), - privateLinkResources ?? new ChangeTrackingList(), - disableLocalAccounts, - httpProxyConfig, - securityProfile, - storageProfile, - publicNetworkAccess, - workloadAutoScalerProfile, - azureMonitorProfile, - serviceMeshProfile, - resourceUID, - 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(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(ExtendedLocation), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" extendedLocation: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ExtendedLocation)) - { - builder.Append(" extendedLocation: "); - BicepSerializationHelpers.AppendChildObject(builder, ExtendedLocation, options, 2, false, " extendedLocation: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClusterIdentity), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identity: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ClusterIdentity)) - { - builder.Append(" identity: "); - BicepSerializationHelpers.AppendChildObject(builder, ClusterIdentity, options, 2, false, " identity: "); - } - } - - 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(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}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PowerStateCode", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" powerState: "); - builder.AppendLine("{"); - builder.AppendLine(" powerState: {"); - builder.Append(" code: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PowerState)) - { - builder.Append(" powerState: "); - BicepSerializationHelpers.AppendChildObject(builder, PowerState, options, 4, false, " powerState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxAgentPools), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxAgentPools: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxAgentPools)) - { - builder.Append(" maxAgentPools: "); - builder.AppendLine($"{MaxAgentPools.Value}"); - } - } - - 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(CurrentKubernetesVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" currentKubernetesVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CurrentKubernetesVersion)) - { - builder.Append(" currentKubernetesVersion: "); - if (CurrentKubernetesVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CurrentKubernetesVersion}'''"); - } - else - { - builder.AppendLine($"'{CurrentKubernetesVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsPrefix), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dnsPrefix: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DnsPrefix)) - { - builder.Append(" dnsPrefix: "); - if (DnsPrefix.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DnsPrefix}'''"); - } - else - { - builder.AppendLine($"'{DnsPrefix}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FqdnSubdomain), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fqdnSubdomain: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FqdnSubdomain)) - { - builder.Append(" fqdnSubdomain: "); - if (FqdnSubdomain.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{FqdnSubdomain}'''"); - } - else - { - builder.AppendLine($"'{FqdnSubdomain}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Fqdn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fqdn: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Fqdn)) - { - builder.Append(" fqdn: "); - if (Fqdn.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Fqdn}'''"); - } - else - { - builder.AppendLine($"'{Fqdn}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateFqdn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateFQDN: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateFqdn)) - { - builder.Append(" privateFQDN: "); - if (PrivateFqdn.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrivateFqdn}'''"); - } - else - { - builder.AppendLine($"'{PrivateFqdn}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AzurePortalFqdn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" azurePortalFQDN: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AzurePortalFqdn)) - { - builder.Append(" azurePortalFQDN: "); - if (AzurePortalFqdn.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AzurePortalFqdn}'''"); - } - else - { - builder.AppendLine($"'{AzurePortalFqdn}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentPoolProfiles), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" agentPoolProfiles: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AgentPoolProfiles)) - { - if (AgentPoolProfiles.Any()) - { - builder.Append(" agentPoolProfiles: "); - builder.AppendLine("["); - foreach (var item in AgentPoolProfiles) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " agentPoolProfiles: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinuxProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linuxProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinuxProfile)) - { - builder.Append(" linuxProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, LinuxProfile, options, 4, false, " linuxProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WindowsProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" windowsProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(WindowsProfile)) - { - builder.Append(" windowsProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, WindowsProfile, options, 4, false, " windowsProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServicePrincipalProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" servicePrincipalProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServicePrincipalProfile)) - { - builder.Append(" servicePrincipalProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, ServicePrincipalProfile, options, 4, false, " servicePrincipalProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AddonProfiles), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" addonProfiles: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AddonProfiles)) - { - if (AddonProfiles.Any()) - { - builder.Append(" addonProfiles: "); - builder.AppendLine("{"); - foreach (var item in AddonProfiles) - { - builder.Append($" '{item.Key}': "); - BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 6, false, " addonProfiles: "); - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodIdentityProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podIdentityProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodIdentityProfile)) - { - builder.Append(" podIdentityProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, PodIdentityProfile, options, 4, false, " podIdentityProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OidcIssuerProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" oidcIssuerProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OidcIssuerProfile)) - { - builder.Append(" oidcIssuerProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, OidcIssuerProfile, options, 4, false, " oidcIssuerProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeResourceGroup), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeResourceGroup: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeResourceGroup)) - { - builder.Append(" nodeResourceGroup: "); - if (NodeResourceGroup.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NodeResourceGroup}'''"); - } - else - { - builder.AppendLine($"'{NodeResourceGroup}'"); - } - } - } - - 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(SupportPlan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" supportPlan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SupportPlan)) - { - builder.Append(" supportPlan: "); - builder.AppendLine($"'{SupportPlan.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePodSecurityPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enablePodSecurityPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnablePodSecurityPolicy)) - { - builder.Append(" enablePodSecurityPolicy: "); - var boolValue = EnablePodSecurityPolicy.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, 4, false, " networkProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AadProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" aadProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AadProfile)) - { - builder.Append(" aadProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, AadProfile, options, 4, false, " aadProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AutoUpgradeProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" autoUpgradeProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AutoUpgradeProfile)) - { - builder.Append(" autoUpgradeProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, AutoUpgradeProfile, options, 4, false, " autoUpgradeProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("UpgradeOverrideSettings", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgradeSettings: "); - builder.AppendLine("{"); - builder.AppendLine(" upgradeSettings: {"); - builder.Append(" overrideSettings: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(UpgradeSettings)) - { - builder.Append(" upgradeSettings: "); - BicepSerializationHelpers.AppendChildObject(builder, UpgradeSettings, options, 4, false, " upgradeSettings: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AutoScalerProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" autoScalerProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AutoScalerProfile)) - { - builder.Append(" autoScalerProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, AutoScalerProfile, options, 4, false, " autoScalerProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiServerAccessProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" apiServerAccessProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ApiServerAccessProfile)) - { - builder.Append(" apiServerAccessProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, ApiServerAccessProfile, options, 4, false, " apiServerAccessProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DiskEncryptionSetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" diskEncryptionSetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DiskEncryptionSetId)) - { - builder.Append(" diskEncryptionSetID: "); - builder.AppendLine($"'{DiskEncryptionSetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdentityProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" identityProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(IdentityProfile)) - { - if (IdentityProfile.Any()) - { - builder.Append(" identityProfile: "); - builder.AppendLine("{"); - foreach (var item in IdentityProfile) - { - builder.Append($" '{item.Key}': "); - BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 6, false, " identityProfile: "); - } - builder.AppendLine(" }"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateLinkResources), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkResources: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PrivateLinkResources)) - { - if (PrivateLinkResources.Any()) - { - builder.Append(" privateLinkResources: "); - builder.AppendLine("["); - foreach (var item in PrivateLinkResources) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " privateLinkResources: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisableLocalAccounts), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" disableLocalAccounts: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DisableLocalAccounts)) - { - builder.Append(" disableLocalAccounts: "); - var boolValue = DisableLocalAccounts.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HttpProxyConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" httpProxyConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HttpProxyConfig)) - { - builder.Append(" httpProxyConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, HttpProxyConfig, options, 4, false, " httpProxyConfig: "); - } - } - - 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(StorageProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" storageProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StorageProfile)) - { - builder.Append(" storageProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, StorageProfile, options, 4, false, " storageProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PublicNetworkAccess)) - { - builder.Append(" publicNetworkAccess: "); - builder.AppendLine($"'{PublicNetworkAccess.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WorkloadAutoScalerProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" workloadAutoScalerProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(WorkloadAutoScalerProfile)) - { - builder.Append(" workloadAutoScalerProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, WorkloadAutoScalerProfile, options, 4, false, " workloadAutoScalerProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("AzureMonitorMetrics", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" azureMonitorProfile: "); - builder.AppendLine("{"); - builder.AppendLine(" azureMonitorProfile: {"); - builder.Append(" metrics: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(AzureMonitorProfile)) - { - builder.Append(" azureMonitorProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, AzureMonitorProfile, options, 4, false, " azureMonitorProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceMeshProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serviceMeshProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServiceMeshProfile)) - { - builder.Append(" serviceMeshProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, ServiceMeshProfile, options, 4, false, " serviceMeshProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" resourceUID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ResourceId)) - { - builder.Append(" resourceUID: "); - builder.AppendLine($"'{ResourceId.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(ContainerServiceManagedClusterData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceManagedClusterData 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); - return DeserializeContainerServiceManagedClusterData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceManagedClusterData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs deleted file mode 100644 index 9d7696707b56..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterData.cs +++ /dev/null @@ -1,324 +0,0 @@ -// 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; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A class representing the ContainerServiceManagedCluster data model. - /// Managed cluster. - /// - public partial class ContainerServiceManagedClusterData : 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 ContainerServiceManagedClusterData(AzureLocation location) : base(location) - { - AgentPoolProfiles = new ChangeTrackingList(); - AddonProfiles = new ChangeTrackingDictionary(); - IdentityProfile = new ChangeTrackingDictionary(); - PrivateLinkResources = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// The managed cluster SKU. - /// The extended location of the Virtual Machine. - /// The identity of the managed cluster, if configured. - /// The current provisioning state. - /// The Power State of the cluster. - /// 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. - /// 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. - /// The FQDN of private cluster. - /// The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. - /// The agent pool properties. - /// The profile for Linux VMs in the Managed Cluster. - /// The profile for Windows VMs in the Managed Cluster. - /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. - /// The profile of managed cluster add-on. - /// 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. - /// 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 network configuration profile. - /// The Azure Active Directory configuration. - /// The auto upgrade configuration. - /// Settings for upgrading a cluster. - /// 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. - /// 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. - /// 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. - /// Service mesh profile for a managed cluster. - /// The resourceUID uniquely identifies ManagedClusters that reuse ARM ResourceIds (i.e: create, delete, create sequence). - /// 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) - { - Sku = sku; - ExtendedLocation = extendedLocation; - ClusterIdentity = clusterIdentity; - ProvisioningState = provisioningState; - PowerState = powerState; - MaxAgentPools = maxAgentPools; - KubernetesVersion = kubernetesVersion; - CurrentKubernetesVersion = currentKubernetesVersion; - DnsPrefix = dnsPrefix; - FqdnSubdomain = fqdnSubdomain; - Fqdn = fqdn; - PrivateFqdn = privateFqdn; - AzurePortalFqdn = azurePortalFqdn; - AgentPoolProfiles = agentPoolProfiles; - LinuxProfile = linuxProfile; - WindowsProfile = windowsProfile; - ServicePrincipalProfile = servicePrincipalProfile; - AddonProfiles = addonProfiles; - PodIdentityProfile = podIdentityProfile; - OidcIssuerProfile = oidcIssuerProfile; - NodeResourceGroup = nodeResourceGroup; - EnableRbac = enableRbac; - SupportPlan = supportPlan; - EnablePodSecurityPolicy = enablePodSecurityPolicy; - NetworkProfile = networkProfile; - AadProfile = aadProfile; - AutoUpgradeProfile = autoUpgradeProfile; - UpgradeSettings = upgradeSettings; - AutoScalerProfile = autoScalerProfile; - ApiServerAccessProfile = apiServerAccessProfile; - DiskEncryptionSetId = diskEncryptionSetId; - IdentityProfile = identityProfile; - PrivateLinkResources = privateLinkResources; - DisableLocalAccounts = disableLocalAccounts; - HttpProxyConfig = httpProxyConfig; - SecurityProfile = securityProfile; - StorageProfile = storageProfile; - PublicNetworkAccess = publicNetworkAccess; - WorkloadAutoScalerProfile = workloadAutoScalerProfile; - AzureMonitorProfile = azureMonitorProfile; - ServiceMeshProfile = serviceMeshProfile; - ResourceId = resourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceManagedClusterData() - { - } - - /// The managed cluster SKU. - [WirePath("sku")] - public ManagedClusterSku Sku { get; set; } - /// The extended location of the Virtual Machine. - [WirePath("extendedLocation")] - public ExtendedLocation ExtendedLocation { get; set; } - /// The identity of the managed cluster, if configured. - [WirePath("identity")] - public ManagedClusterIdentity ClusterIdentity { get; set; } - /// The current provisioning state. - [WirePath("properties.provisioningState")] - public string ProvisioningState { get; } - /// The Power State of the cluster. - internal ContainerServicePowerState PowerState { get; } - /// Tells whether the cluster is Running or Stopped. - [WirePath("properties.powerState.code")] - public ContainerServiceStateCode? PowerStateCode - { - get => PowerState?.Code; - } - - /// 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. - [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. - [WirePath("properties.currentKubernetesVersion")] - public string CurrentKubernetesVersion { get; } - /// This cannot be updated once the Managed Cluster has been created. - [WirePath("properties.dnsPrefix")] - public string DnsPrefix { get; set; } - /// This cannot be updated once the Managed Cluster has been created. - [WirePath("properties.fqdnSubdomain")] - public string FqdnSubdomain { get; set; } - /// The FQDN of the master pool. - [WirePath("properties.fqdn")] - public string Fqdn { get; } - /// The FQDN of private cluster. - [WirePath("properties.privateFQDN")] - public string PrivateFqdn { get; } - /// The Azure Portal requires certain Cross-Origin Resource Sharing (CORS) headers to be sent in some responses, which Kubernetes APIServer doesn't handle by default. This special FQDN supports CORS, allowing the Azure Portal to function properly. - [WirePath("properties.azurePortalFQDN")] - public string AzurePortalFqdn { get; } - /// The agent pool properties. - [WirePath("properties.agentPoolProfiles")] - public IList AgentPoolProfiles { get; } - /// The profile for Linux VMs in the Managed Cluster. - [WirePath("properties.linuxProfile")] - public ContainerServiceLinuxProfile LinuxProfile { get; set; } - /// The profile for Windows VMs in the Managed Cluster. - [WirePath("properties.windowsProfile")] - public ManagedClusterWindowsProfile WindowsProfile { get; set; } - /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. - [WirePath("properties.servicePrincipalProfile")] - public ManagedClusterServicePrincipalProfile ServicePrincipalProfile { get; set; } - /// The profile of managed cluster add-on. - [WirePath("properties.addonProfiles")] - public IDictionary AddonProfiles { get; } - /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on AAD pod identity integration. - [WirePath("properties.podIdentityProfile")] - public ManagedClusterPodIdentityProfile PodIdentityProfile { get; set; } - /// The OIDC issuer profile of the Managed Cluster. - [WirePath("properties.oidcIssuerProfile")] - public ManagedClusterOidcIssuerProfile OidcIssuerProfile { get; set; } - /// The name of the resource group containing agent pool nodes. - [WirePath("properties.nodeResourceGroup")] - public string NodeResourceGroup { get; set; } - /// 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 network configuration profile. - [WirePath("properties.networkProfile")] - public ContainerServiceNetworkProfile NetworkProfile { get; set; } - /// The Azure Active Directory configuration. - [WirePath("properties.aadProfile")] - public ManagedClusterAadProfile AadProfile { get; set; } - /// The auto upgrade configuration. - [WirePath("properties.autoUpgradeProfile")] - public ManagedClusterAutoUpgradeProfile AutoUpgradeProfile { get; set; } - /// Settings for upgrading a cluster. - internal ClusterUpgradeSettings UpgradeSettings { get; set; } - /// Settings for overrides. - [WirePath("properties.upgradeSettings.overrideSettings")] - public UpgradeOverrideSettings UpgradeOverrideSettings - { - get => UpgradeSettings is null ? default : UpgradeSettings.OverrideSettings; - set - { - if (UpgradeSettings is null) - UpgradeSettings = new ClusterUpgradeSettings(); - UpgradeSettings.OverrideSettings = value; - } - } - - /// Parameters to be applied to the cluster-autoscaler when enabled. - [WirePath("properties.autoScalerProfile")] - public ManagedClusterAutoScalerProfile AutoScalerProfile { get; set; } - /// The access profile for managed cluster API server. - [WirePath("properties.apiServerAccessProfile")] - public ManagedClusterApiServerAccessProfile ApiServerAccessProfile { get; set; } - /// 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. - [WirePath("properties.identityProfile")] - public IDictionary IdentityProfile { get; } - /// Private link resources associated with the cluster. - [WirePath("properties.privateLinkResources")] - public IList PrivateLinkResources { get; } - /// 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). - [WirePath("properties.disableLocalAccounts")] - public bool? DisableLocalAccounts { get; set; } - /// Configurations for provisioning the cluster with HTTP proxy servers. - [WirePath("properties.httpProxyConfig")] - public ManagedClusterHttpProxyConfig HttpProxyConfig { get; set; } - /// Security profile for the managed cluster. - [WirePath("properties.securityProfile")] - public ManagedClusterSecurityProfile SecurityProfile { get; set; } - /// 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 - { - get => AzureMonitorProfile is null ? default : AzureMonitorProfile.Metrics; - set - { - if (AzureMonitorProfile is null) - AzureMonitorProfile = new ManagedClusterAzureMonitorProfile(); - AzureMonitorProfile.Metrics = value; - } - } - - /// 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; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.Serialization.cs deleted file mode 100644 index f6bdecf803e9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.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 ContainerServiceManagedClusterResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ContainerServiceManagedClusterData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ContainerServiceManagedClusterData 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/ContainerServiceManagedClusterResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs deleted file mode 100644 index e9761b7a74dd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceManagedClusterResource.cs +++ /dev/null @@ -1,2330 +0,0 @@ -// 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 Autorest.CSharp.Core; -using Azure.Core; -using Azure.Core.Pipeline; -using Azure.ResourceManager.ContainerService.Models; -using Azure.ResourceManager.Resources; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A Class representing a ContainerServiceManagedCluster 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 GetContainerServiceManagedClusterResource method. - /// Otherwise you can get one from its parent resource using the GetContainerServiceManagedCluster method. - /// - public partial class ContainerServiceManagedClusterResource : 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/managedClusters/{resourceName}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; - private readonly ClientDiagnostics _agentPoolsClientDiagnostics; - private readonly AgentPoolsRestOperations _agentPoolsRestClient; - private readonly ClientDiagnostics _privateLinkResourcesClientDiagnostics; - private readonly PrivateLinkResourcesRestOperations _privateLinkResourcesRestClient; - private readonly ClientDiagnostics _resolvePrivateLinkServiceIdClientDiagnostics; - private readonly ResolvePrivateLinkServiceIdRestOperations _resolvePrivateLinkServiceIdRestClient; - private readonly ContainerServiceManagedClusterData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters"; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceManagedClusterResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal ContainerServiceManagedClusterResource(ArmClient client, ContainerServiceManagedClusterData 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 ContainerServiceManagedClusterResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceManagedClusterManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string containerServiceManagedClusterManagedClustersApiVersion); - _containerServiceManagedClusterManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceManagedClusterManagedClustersApiVersion); - _agentPoolsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _agentPoolsRestClient = new AgentPoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _privateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _privateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); - _resolvePrivateLinkServiceIdClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _resolvePrivateLinkServiceIdRestClient = new ResolvePrivateLinkServiceIdRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); -#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 ContainerServiceManagedClusterData 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 an object representing a ManagedClusterUpgradeProfileResource along with the instance operations that can be performed on it in the ContainerServiceManagedCluster. - /// Returns a object. - public virtual ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfile() - { - return new ManagedClusterUpgradeProfileResource(Client, Id.AppendChildResource("upgradeProfiles", "default")); - } - - /// Gets a collection of MeshUpgradeProfileResources in the ContainerServiceManagedCluster. - /// An object representing collection of MeshUpgradeProfileResources and their operations over a MeshUpgradeProfileResource. - public virtual MeshUpgradeProfileCollection GetMeshUpgradeProfiles() - { - return GetCachedClient(client => new MeshUpgradeProfileCollection(client, Id)); - } - - /// - /// Gets available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetMeshUpgradeProfileAsync(string mode, CancellationToken cancellationToken = default) - { - return await GetMeshUpgradeProfiles().GetAsync(mode, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetMeshUpgradeProfile(string mode, CancellationToken cancellationToken = default) - { - return GetMeshUpgradeProfiles().Get(mode, cancellationToken); - } - - /// Gets a collection of ContainerServiceMaintenanceConfigurationResources in the ContainerServiceManagedCluster. - /// An object representing collection of ContainerServiceMaintenanceConfigurationResources and their operations over a ContainerServiceMaintenanceConfigurationResource. - public virtual ContainerServiceMaintenanceConfigurationCollection GetContainerServiceMaintenanceConfigurations() - { - return GetCachedClient(client => new ContainerServiceMaintenanceConfigurationCollection(client, Id)); - } - - /// - /// Gets the specified maintenance configuration of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetContainerServiceMaintenanceConfigurationAsync(string configName, CancellationToken cancellationToken = default) - { - return await GetContainerServiceMaintenanceConfigurations().GetAsync(configName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified maintenance configuration of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} - /// - /// - /// Operation Id - /// MaintenanceConfigurations_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the maintenance configuration. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetContainerServiceMaintenanceConfiguration(string configName, CancellationToken cancellationToken = default) - { - return GetContainerServiceMaintenanceConfigurations().Get(configName, 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() - { - return GetCachedClient(client => new ContainerServiceAgentPoolCollection(client, Id)); - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetContainerServiceAgentPoolAsync(string agentPoolName, CancellationToken cancellationToken = default) - { - return await GetContainerServiceAgentPools().GetAsync(agentPoolName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets the specified managed cluster agent pool. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/agentPools/{agentPoolName} - /// - /// - /// Operation Id - /// AgentPools_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the agent pool. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetContainerServiceAgentPool(string agentPoolName, CancellationToken cancellationToken = default) - { - return GetContainerServiceAgentPools().Get(agentPoolName, cancellationToken); - } - - /// Gets a collection of ContainerServicePrivateEndpointConnectionResources in the ContainerServiceManagedCluster. - /// An object representing collection of ContainerServicePrivateEndpointConnectionResources and their operations over a ContainerServicePrivateEndpointConnectionResource. - public virtual ContainerServicePrivateEndpointConnectionCollection GetContainerServicePrivateEndpointConnections() - { - return GetCachedClient(client => new ContainerServicePrivateEndpointConnectionCollection(client, Id)); - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetContainerServicePrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return await GetContainerServicePrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetContainerServicePrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - return GetContainerServicePrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); - } - - /// Gets a collection of ContainerServiceTrustedAccessRoleBindingResources in the ContainerServiceManagedCluster. - /// An object representing collection of ContainerServiceTrustedAccessRoleBindingResources and their operations over a ContainerServiceTrustedAccessRoleBindingResource. - public virtual ContainerServiceTrustedAccessRoleBindingCollection GetContainerServiceTrustedAccessRoleBindings() - { - return GetCachedClient(client => new ContainerServiceTrustedAccessRoleBindingCollection(client, Id)); - } - - /// - /// Get a trusted access role binding. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetContainerServiceTrustedAccessRoleBindingAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - return await GetContainerServiceTrustedAccessRoleBindings().GetAsync(trustedAccessRoleBindingName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Get a trusted access role binding. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetContainerServiceTrustedAccessRoleBinding(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - return GetContainerServiceTrustedAccessRoleBindings().Get(trustedAccessRoleBindingName, cancellationToken); - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Get"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Get"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceManagedClusterResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates tags on a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_UpdateTags - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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. - /// Parameters supplied to the Update Managed Cluster Tags operation. - /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Update"); - 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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates tags on a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_UpdateTags - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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. - /// Parameters supplied to the Update Managed Cluster Tags operation. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceTagsObject containerServiceTagsObject, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(containerServiceTagsObject, nameof(containerServiceTagsObject)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Update"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// **WARNING**: This API will be deprecated. Instead use [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential - /// - /// - /// Operation Id - /// ManagedClusters_GetAccessProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The name of the role for managed cluster accessProfile resource. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAccessProfileAsync(string roleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetAccessProfile"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.GetAccessProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// **WARNING**: This API will be deprecated. Instead use [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/accessProfiles/{roleName}/listCredential - /// - /// - /// Operation Id - /// ManagedClusters_GetAccessProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The name of the role for managed cluster accessProfile resource. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetAccessProfile(string roleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetAccessProfile"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.GetAccessProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, roleName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the admin credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterAdminCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - public virtual async Task> GetClusterAdminCredentialsAsync(string serverFqdn = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterAdminCredentials"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.ListClusterAdminCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the admin credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterAdminCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterAdminCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - public virtual Response GetClusterAdminCredentials(string serverFqdn = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterAdminCredentials"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.ListClusterAdminCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the user credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterUserCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires kubelogin binary in the path. - /// The cancellation token to use. - public virtual async Task> GetClusterUserCredentialsAsync(string serverFqdn = null, KubeConfigFormat? format = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterUserCredentials"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.ListClusterUserCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, format, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the user credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterUserCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterUserCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires kubelogin binary in the path. - /// The cancellation token to use. - public virtual Response GetClusterUserCredentials(string serverFqdn = null, KubeConfigFormat? format = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterUserCredentials"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.ListClusterUserCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, format, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the cluster monitoring user credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterMonitoringUserCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - public virtual async Task> GetClusterMonitoringUserCredentialsAsync(string serverFqdn = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterMonitoringUserCredentials"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.ListClusterMonitoringUserCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists the cluster monitoring user credentials of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/listClusterMonitoringUserCredential - /// - /// - /// Operation Id - /// ManagedClusters_ListClusterMonitoringUserCredentials - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - public virtual Response GetClusterMonitoringUserCredentials(string serverFqdn = null, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetClusterMonitoringUserCredentials"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.ListClusterMonitoringUserCredentials(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, serverFqdn, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This action cannot be performed on a cluster that is not using a service principal - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile - /// - /// - /// Operation Id - /// ManagedClusters_ResetServicePrincipalProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 service principal profile to set on the managed cluster. - /// The cancellation token to use. - /// is null. - public virtual async Task ResetServicePrincipalProfileAsync(WaitUntil waitUntil, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(managedClusterServicePrincipalProfile, nameof(managedClusterServicePrincipalProfile)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResetServicePrincipalProfile"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.ResetServicePrincipalProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterServicePrincipalProfile, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateResetServicePrincipalProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterServicePrincipalProfile).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This action cannot be performed on a cluster that is not using a service principal - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetServicePrincipalProfile - /// - /// - /// Operation Id - /// ManagedClusters_ResetServicePrincipalProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 service principal profile to set on the managed cluster. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation ResetServicePrincipalProfile(WaitUntil waitUntil, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(managedClusterServicePrincipalProfile, nameof(managedClusterServicePrincipalProfile)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResetServicePrincipalProfile"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.ResetServicePrincipalProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterServicePrincipalProfile, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateResetServicePrincipalProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterServicePrincipalProfile).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// **WARNING**: This API will be deprecated. Please see [AKS-managed Azure Active Directory integration](https://aka.ms/aks-managed-aad) to update your cluster with AKS-managed Azure AD. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile - /// - /// - /// Operation Id - /// ManagedClusters_ResetAadProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AAD profile to set on the Managed Cluster. - /// The cancellation token to use. - /// is null. - public virtual async Task ResetAadProfileAsync(WaitUntil waitUntil, ManagedClusterAadProfile managedClusterAadProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(managedClusterAadProfile, nameof(managedClusterAadProfile)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResetAadProfile"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.ResetAadProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterAadProfile, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateResetAadProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterAadProfile).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// **WARNING**: This API will be deprecated. Please see [AKS-managed Azure Active Directory integration](https://aka.ms/aks-managed-aad) to update your cluster with AKS-managed Azure AD. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resetAADProfile - /// - /// - /// Operation Id - /// ManagedClusters_ResetAadProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AAD profile to set on the Managed Cluster. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation ResetAadProfile(WaitUntil waitUntil, ManagedClusterAadProfile managedClusterAadProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(managedClusterAadProfile, nameof(managedClusterAadProfile)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResetAadProfile"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.ResetAadProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterAadProfile, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateResetAadProfileRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedClusterAadProfile).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// 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}/rotateClusterCertificates - /// - /// - /// Operation Id - /// ManagedClusters_RotateClusterCertificates - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 RotateClusterCertificatesAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); - 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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// 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}/rotateClusterCertificates - /// - /// - /// Operation Id - /// ManagedClusters_RotateClusterCertificates - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 RotateClusterCertificates(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateClusterCertificates"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort - /// - /// - /// Operation Id - /// ManagedClusters_AbortLatestOperation - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AbortLatestOperationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); - 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); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedclusters/{resourceName}/abort - /// - /// - /// Operation Id - /// ManagedClusters_AbortLatestOperation - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 AbortLatestOperation(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.AbortLatestOperation"); - 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); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Rotates the service account signing keys of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys - /// - /// - /// Operation Id - /// ManagedClusters_RotateServiceAccountSigningKeys - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 RotateServiceAccountSigningKeysAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateServiceAccountSigningKeys"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.RotateServiceAccountSigningKeysAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateServiceAccountSigningKeysRequest(Id.SubscriptionId, Id.ResourceGroupName, 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; - } - } - - /// - /// Rotates the service account signing keys of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/rotateServiceAccountSigningKeys - /// - /// - /// Operation Id - /// ManagedClusters_RotateServiceAccountSigningKeys - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 RotateServiceAccountSigningKeys(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RotateServiceAccountSigningKeys"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.RotateServiceAccountSigningKeys(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRotateServiceAccountSigningKeysRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop - /// - /// - /// Operation Id - /// ManagedClusters_Stop - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Stop"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, 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; - } - } - - /// - /// This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/stop - /// - /// - /// Operation Id - /// ManagedClusters_Stop - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 Stop(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Stop"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start - /// - /// - /// Operation Id - /// ManagedClusters_Start - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 StartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Start"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, 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; - } - } - - /// - /// See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/start - /// - /// - /// Operation Id - /// ManagedClusters_Start - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 Start(WaitUntil waitUntil, CancellationToken cancellationToken = default) - { - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.Start"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand - /// - /// - /// Operation Id - /// ManagedClusters_RunCommand - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 run command request. - /// The cancellation token to use. - /// is null. - public virtual async Task> RunCommandAsync(WaitUntil waitUntil, ManagedClusterRunCommandContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RunCommand"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.RunCommandAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ManagedClusterRunCommandResultOperationSource(), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRunCommandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/runCommand - /// - /// - /// Operation Id - /// ManagedClusters_RunCommand - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 run command request. - /// The cancellation token to use. - /// is null. - public virtual ArmOperation RunCommand(WaitUntil waitUntil, ManagedClusterRunCommandContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.RunCommand"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.RunCommand(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); - var operation = new ContainerServiceArmOperation(new ManagedClusterRunCommandResultOperationSource(), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, _containerServiceManagedClusterManagedClustersRestClient.CreateRunCommandRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the results of a command which has been run on the Managed Cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId} - /// - /// - /// Operation Id - /// ManagedClusters_GetCommandResult - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// Id of the command. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetCommandResultAsync(string commandId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetCommandResult"); - scope.Start(); - try - { - var response = await _containerServiceManagedClusterManagedClustersRestClient.GetCommandResultAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commandId, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the results of a command which has been run on the Managed Cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/commandResults/{commandId} - /// - /// - /// Operation Id - /// ManagedClusters_GetCommandResult - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// Id of the command. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response GetCommandResult(string commandId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - using var scope = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetCommandResult"); - scope.Start(); - try - { - var response = _containerServiceManagedClusterManagedClustersRestClient.GetCommandResult(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, commandId, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints - /// - /// - /// Operation Id - /// ManagedClusters_ListOutboundNetworkDependenciesEndpoints - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetOutboundNetworkDependenciesEndpointsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceManagedClusterManagedClustersRestClient.CreateListOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ContainerServiceOutboundEnvironmentEndpoint.DeserializeContainerServiceOutboundEnvironmentEndpoint(e), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetOutboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/outboundNetworkDependenciesEndpoints - /// - /// - /// Operation Id - /// ManagedClusters_ListOutboundNetworkDependenciesEndpoints - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetOutboundNetworkDependenciesEndpoints(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _containerServiceManagedClusterManagedClustersRestClient.CreateListOutboundNetworkDependenciesEndpointsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceManagedClusterManagedClustersRestClient.CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ContainerServiceOutboundEnvironmentEndpoint.DeserializeContainerServiceOutboundEnvironmentEndpoint(e), _containerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetOutboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken); - } - - /// - /// See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions - /// - /// - /// Operation Id - /// AgentPools_GetAvailableAgentPoolVersions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAvailableAgentPoolVersionsAsync(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolsClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetAvailableAgentPoolVersions"); - scope.Start(); - try - { - var response = await _agentPoolsRestClient.GetAvailableAgentPoolVersionsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return response; - } - 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. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/availableAgentPoolVersions - /// - /// - /// Operation Id - /// AgentPools_GetAvailableAgentPoolVersions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The cancellation token to use. - public virtual Response GetAvailableAgentPoolVersions(CancellationToken cancellationToken = default) - { - using var scope = _agentPoolsClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.GetAvailableAgentPoolVersions"); - scope.Start(); - try - { - var response = _agentPoolsRestClient.GetAvailableAgentPoolVersions(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetPrivateLinkResourcesAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateLinkResources - /// - /// - /// Operation Id - /// PrivateLinkResources_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetPrivateLinkResources(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => _privateLinkResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(e), _privateLinkResourcesClientDiagnostics, Pipeline, "ContainerServiceManagedClusterResource.GetPrivateLinkResources", "value", null, cancellationToken); - } - - /// - /// Gets the private link service ID for the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId - /// - /// - /// Operation Id - /// ResolvePrivateLinkServiceId_Post - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// Parameters required in order to resolve a private link service ID. - /// The cancellation token to use. - /// is null. - public virtual async Task> ResolvePrivateLinkServiceIdAsync(ContainerServicePrivateLinkResourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _resolvePrivateLinkServiceIdClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResolvePrivateLinkServiceId"); - scope.Start(); - try - { - var response = await _resolvePrivateLinkServiceIdRestClient.PostAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the private link service ID for the specified managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/resolvePrivateLinkServiceId - /// - /// - /// Operation Id - /// ResolvePrivateLinkServiceId_Post - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// Parameters required in order to resolve a private link service ID. - /// The cancellation token to use. - /// is null. - public virtual Response ResolvePrivateLinkServiceId(ContainerServicePrivateLinkResourceData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _resolvePrivateLinkServiceIdClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.ResolvePrivateLinkServiceId"); - scope.Start(); - try - { - var response = _resolvePrivateLinkServiceIdRestClient.Post(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceManagedClusterResource(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(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceManagedClusterResource(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(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceManagedClusterResource(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(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceManagedClusterResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); - } - else - { - var current = Get(cancellationToken: cancellationToken).Value.Data; - var patch = new ContainerServiceTagsObject(); - patch.Tags.ReplaceWith(tags); - var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 _containerServiceManagedClusterManagedClustersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ContainerServiceManagedClusterResource(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(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - 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} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 = _containerServiceManagedClusterManagedClustersClientDiagnostics.CreateScope("ContainerServiceManagedClusterResource.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 = _containerServiceManagedClusterManagedClustersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - return Response.FromValue(new ContainerServiceManagedClusterResource(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(WaitUntil.Completed, patch, cancellationToken: cancellationToken); - return Response.FromValue(result.Value, result.GetRawResponse()); - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs deleted file mode 100644 index e42d1a48311f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionCollection.cs +++ /dev/null @@ -1,495 +0,0 @@ -// 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 GetContainerServicePrivateEndpointConnections method from an instance of . - /// - public partial class ContainerServicePrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ContainerServicePrivateEndpointConnectionCollection() - { - } - - /// 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 ContainerServicePrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServicePrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ContainerServicePrivateEndpointConnectionResource.ResourceType, out string containerServicePrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServicePrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); -#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)); - } - - /// - /// Updates a private endpoint connection. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Update - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 private endpoint connection. - /// The updated private endpoint connection. - /// 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 privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); - var uri = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Updates a private endpoint connection. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Update - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 private endpoint connection. - /// The updated private endpoint connection. - /// 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 privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); - var uri = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.Get"); - scope.Start(); - try - { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.Get"); - scope.Start(); - try - { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections - /// - /// - /// Operation Id - /// PrivateEndpointConnections_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections - /// - /// - /// Operation Id - /// PrivateEndpointConnections_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new ContainerServicePrivateEndpointConnectionResource(Client, ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(e)), _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "ContainerServicePrivateEndpointConnectionCollection.GetAll", "value", null, cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.Exists"); - scope.Start(); - try - { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, 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}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.Exists"); - scope.Start(); - try - { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, 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}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(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}/privateEndpointConnections/{privateEndpointConnectionName} - /// - /// - /// Operation Id - /// PrivateEndpointConnections_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the private endpoint connection. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionCollection.GetIfExists"); - scope.Start(); - try - { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(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/ContainerServicePrivateEndpointConnectionData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs deleted file mode 100644 index 02c71aec80f9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.cs +++ /dev/null @@ -1,99 +0,0 @@ -// 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; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A class representing the ContainerServicePrivateEndpointConnection data model. - /// A private endpoint connection - /// - public partial class ContainerServicePrivateEndpointConnectionData : 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 ContainerServicePrivateEndpointConnectionData() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The current provisioning state. - /// The resource of private endpoint. - /// A collection of information about the state of the connection between service consumer and provider. - /// Keeps track of any properties unknown to the library. - internal ContainerServicePrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState, WritableSubResource privateEndpoint, ContainerServicePrivateLinkServiceConnectionState connectionState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - ProvisioningState = provisioningState; - PrivateEndpoint = privateEndpoint; - ConnectionState = connectionState; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The current provisioning state. - [WirePath("properties.provisioningState")] - public ContainerServicePrivateEndpointConnectionProvisioningState? ProvisioningState { get; } - /// The resource of private endpoint. - internal WritableSubResource PrivateEndpoint { get; set; } - /// Gets or sets Id. - [WirePath("properties.privateEndpoint.id")] - public ResourceIdentifier PrivateEndpointId - { - get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; - set - { - if (PrivateEndpoint is null) - PrivateEndpoint = new WritableSubResource(); - PrivateEndpoint.Id = value; - } - } - - /// A collection of information about the state of the connection between service consumer and provider. - [WirePath("properties.privateLinkServiceConnectionState")] - public ContainerServicePrivateLinkServiceConnectionState ConnectionState { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.Serialization.cs deleted file mode 100644 index d5486963c65b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.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 ContainerServicePrivateEndpointConnectionResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ContainerServicePrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ContainerServicePrivateEndpointConnectionData 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/ContainerServiceTrustedAccessRoleBindingCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs deleted file mode 100644 index 53b1a5b4fea4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingCollection.cs +++ /dev/null @@ -1,493 +0,0 @@ -// 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 GetContainerServiceTrustedAccessRoleBindings method from an instance of . - /// - public partial class ContainerServiceTrustedAccessRoleBindingCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics; - private readonly TrustedAccessRoleBindingsRestOperations _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient; - - /// Initializes a new instance of the class for mocking. - protected ContainerServiceTrustedAccessRoleBindingCollection() - { - } - - /// 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 ContainerServiceTrustedAccessRoleBindingCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ContainerServiceTrustedAccessRoleBindingResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ContainerServiceTrustedAccessRoleBindingResource.ResourceType, out string containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsApiVersion); - _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient = new TrustedAccessRoleBindingsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsApiVersion); -#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)); - } - - /// - /// Create or update a trusted access role binding - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 trusted access role binding. - /// A trusted access role binding. - /// 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 trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, data, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(new ContainerServiceTrustedAccessRoleBindingOperationSource(Client), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Create or update a trusted access role binding - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_CreateOrUpdate - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 trusted access role binding. - /// A trusted access role binding. - /// 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 trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - Argument.AssertNotNull(data, nameof(data)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.CreateOrUpdate"); - scope.Start(); - try - { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, data, cancellationToken); - var operation = new ContainerServiceArmOperation(new ContainerServiceTrustedAccessRoleBindingOperationSource(Client), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, data).Request, response, OperationFinalStateVia.Location); - if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletion(cancellationToken); - return operation; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a trusted access role binding. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.Get"); - scope.Start(); - try - { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Get a trusted access role binding. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.Get"); - scope.Start(); - try - { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List trusted access role bindings. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// List trusted access role bindings. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceTrustedAccessRoleBindingResource(Client, ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(e)), _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics, Pipeline, "ContainerServiceTrustedAccessRoleBindingCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.Exists"); - scope.Start(); - try - { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, 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}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.Exists"); - scope.Start(); - try - { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, 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}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(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}/trustedAccessRoleBindings/{trustedAccessRoleBindingName} - /// - /// - /// Operation Id - /// TrustedAccessRoleBindings_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of trusted access role binding. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); - - using var scope = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsClientDiagnostics.CreateScope("ContainerServiceTrustedAccessRoleBindingCollection.GetIfExists"); - scope.Start(); - try - { - var response = _containerServiceTrustedAccessRoleBindingTrustedAccessRoleBindingsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, trustedAccessRoleBindingName, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceTrustedAccessRoleBindingResource(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/ContainerServiceTrustedAccessRoleBindingData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs deleted file mode 100644 index a03c55e2dce6..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.cs +++ /dev/null @@ -1,100 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; -using Azure.ResourceManager.ContainerService.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A class representing the ContainerServiceTrustedAccessRoleBinding data model. - /// Defines binding between a resource and role - /// - public partial class ContainerServiceTrustedAccessRoleBindingData : 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 . - /// 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'. - /// or is null. - public ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier sourceResourceId, IEnumerable roles) - { - Argument.AssertNotNull(sourceResourceId, nameof(sourceResourceId)); - Argument.AssertNotNull(roles, nameof(roles)); - - SourceResourceId = sourceResourceId; - Roles = roles.ToList(); - } - - /// 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'. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceTrustedAccessRoleBindingData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState, ResourceIdentifier sourceResourceId, IList roles, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - ProvisioningState = provisioningState; - SourceResourceId = sourceResourceId; - Roles = roles; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceTrustedAccessRoleBindingData() - { - } - - /// The current provisioning state of trusted access role binding. - [WirePath("properties.provisioningState")] - public ContainerServiceTrustedAccessRoleBindingProvisioningState? ProvisioningState { get; } - /// The ARM resource ID of source resource that trusted access is configured for. - [WirePath("properties.sourceResourceId")] - public ResourceIdentifier SourceResourceId { get; set; } - /// A list of roles to bind, each item is a resource type qualified role name. For example: 'Microsoft.MachineLearningServices/workspaces/reader'. - [WirePath("properties.roles")] - public IList Roles { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.Serialization.cs deleted file mode 100644 index 6215413fdc3f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingResource.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 ContainerServiceTrustedAccessRoleBindingResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ContainerServiceTrustedAccessRoleBindingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ContainerServiceTrustedAccessRoleBindingData 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/Extensions/ContainerServiceExtensions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs index 9d4c114d8c6b..79287b6575b6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/ContainerServiceExtensions.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.ResourceManager.ContainerService.Mocking; -using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.ContainerService @@ -34,768 +33,263 @@ 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 FleetResource GetFleetResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetOSOptionProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetFleetResource(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 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. /// /// 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 AutoUpgradeProfileResource GetAutoUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetManagedClusterUpgradeProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetAutoUpgradeProfileResource(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 FleetMemberResource GetFleetMemberResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetContainerServiceManagedClusterResource(id); + return GetMockableContainerServiceArmClient(client).GetFleetMemberResource(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 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. /// /// 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 MeshRevisionProfileResource GetMeshRevisionProfileResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static UpdateRunResource GetUpdateRunResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetMeshRevisionProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetUpdateRunResource(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 MeshUpgradeProfileResource GetMeshUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) + /// Returns a object. + public static FleetUpdateStrategyResource GetFleetUpdateStrategyResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableContainerServiceArmClient(client).GetMeshUpgradeProfileResource(id); + return GetMockableContainerServiceArmClient(client).GetFleetUpdateStrategyResource(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 a collection of FleetResources in the ResourceGroupResource. /// /// 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 ContainerServiceMaintenanceConfigurationResource GetContainerServiceMaintenanceConfigurationResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - 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 ContainerServiceAgentPoolResource GetContainerServiceAgentPoolResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableContainerServiceArmClient(client).GetContainerServiceAgentPoolResource(id); - } - - /// - /// 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. - /// - /// 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 AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - 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 ContainerServicePrivateEndpointConnectionResource GetContainerServicePrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableContainerServiceArmClient(client).GetContainerServicePrivateEndpointConnectionResource(id); - } - - /// - /// 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. - /// - /// 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 AgentPoolSnapshotResource GetAgentPoolSnapshotResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - 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 ContainerServiceTrustedAccessRoleBindingResource GetContainerServiceTrustedAccessRoleBindingResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableContainerServiceArmClient(client).GetContainerServiceTrustedAccessRoleBindingResource(id); - } - - /// - /// Gets a collection of ContainerServiceManagedClusterResources 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 ContainerServiceManagedClusterResources and their operations over a ContainerServiceManagedClusterResource. - public static ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters(this ResourceGroupResource resourceGroupResource) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedClusters(); - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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> GetContainerServiceManagedClusterAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedClusterAsync(resourceName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} - /// - /// - /// Operation Id - /// ManagedClusters_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 GetContainerServiceManagedCluster(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - - return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetContainerServiceManagedCluster(resourceName, cancellationToken); - } - - /// - /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. - /// - /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. - /// An object representing collection of AgentPoolSnapshotResources and their operations over a AgentPoolSnapshotResource. - public static AgentPoolSnapshotCollection GetAgentPoolSnapshots(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of FleetResources and their operations over a FleetResource. + public static FleetCollection GetFleets(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshots(); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetFleets(); } /// - /// Gets a snapshot. + /// Gets a Fleet. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} /// /// /// Operation Id - /// Snapshots_Get + /// Fleets_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetAgentPoolSnapshotAsync(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + public static async Task> GetFleetAsync(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshotAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetFleetAsync(fleetName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a snapshot. + /// Gets a Fleet. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} /// /// /// Operation Id - /// Snapshots_Get + /// Fleets_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetAgentPoolSnapshot(this ResourceGroupResource resourceGroupResource, string resourceName, CancellationToken cancellationToken = default) + public static Response GetFleet(this ResourceGroupResource resourceGroupResource, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetAgentPoolSnapshot(resourceName, cancellationToken); - } - - /// - /// Gets a collection of MeshRevisionProfileResources 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 MeshRevisionProfileResources and their operations over a MeshRevisionProfileResource. - public static MeshRevisionProfileCollection GetMeshRevisionProfiles(this SubscriptionResource subscriptionResource, AzureLocation location) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetMeshRevisionProfiles(location); - } - - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The mode of the mesh. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static async Task> GetMeshRevisionProfileAsync(this SubscriptionResource subscriptionResource, AzureLocation location, string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return await GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetMeshRevisionProfileAsync(location, mode, cancellationToken).ConfigureAwait(false); - } - - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The name of the Azure region. - /// The mode of the mesh. - /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public static Response GetMeshRevisionProfile(this SubscriptionResource subscriptionResource, AzureLocation location, string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetMeshRevisionProfile(location, mode, cancellationToken); - } - - /// - /// Contains extra metadata on the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the version - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions - /// - /// - /// Operation Id - /// ManagedClusters_ListKubernetesVersions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// 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. - public static async Task> GetKubernetesVersionsManagedClusterAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return await GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetKubernetesVersionsManagedClusterAsync(location, cancellationToken).ConfigureAwait(false); - } - - /// - /// Contains extra metadata on the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the version - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions - /// - /// - /// Operation Id - /// ManagedClusters_ListKubernetesVersions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// 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. - public static Response GetKubernetesVersionsManagedCluster(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetKubernetesVersionsManagedCluster(location, cancellationToken); - } - - /// - /// Gets a list of managed clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 GetContainerServiceManagedClustersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceManagedClustersAsync(cancellationToken); + return GetMockableContainerServiceResourceGroupResource(resourceGroupResource).GetFleet(fleetName, cancellationToken); } /// - /// Gets a list of managed clusters in the specified subscription. + /// Lists fleets in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets /// /// /// Operation Id - /// ManagedClusters_List + /// Fleets_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// 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 GetContainerServiceManagedClusters(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetFleetsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetContainerServiceManagedClusters(cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetFleetsAsync(cancellationToken); } /// - /// Gets a list of snapshots in the specified subscription. + /// Lists fleets in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets /// /// /// Operation Id - /// Snapshots_List + /// Fleets_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 GetAgentPoolSnapshotsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetAgentPoolSnapshotsAsync(cancellationToken); - } - - /// - /// Gets a list of snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 GetAgentPoolSnapshots(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetAgentPoolSnapshots(cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// 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 GetTrustedAccessRolesAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetTrustedAccessRolesAsync(location, cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// Default Api Version - /// 2023-10-01 + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// 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 GetTrustedAccessRoles(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetFleets(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetTrustedAccessRoles(location, cancellationToken); + return GetMockableContainerServiceSubscriptionResource(subscriptionResource).GetFleets(cancellationToken); } } } 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..3900ab0208de 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceArmClient.cs @@ -35,135 +35,63 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// 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. /// /// The resource ID of the resource to get. - /// Returns a object. - public virtual OSOptionProfileResource GetOSOptionProfileResource(ResourceIdentifier id) + /// Returns a object. + public virtual FleetResource GetFleetResource(ResourceIdentifier id) { - OSOptionProfileResource.ValidateResourceId(id); - return new OSOptionProfileResource(Client, id); + FleetResource.ValidateResourceId(id); + return new FleetResource(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. + /// 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 ManagedClusterUpgradeProfileResource GetManagedClusterUpgradeProfileResource(ResourceIdentifier id) + /// Returns a object. + public virtual AutoUpgradeProfileResource GetAutoUpgradeProfileResource(ResourceIdentifier id) { - ManagedClusterUpgradeProfileResource.ValidateResourceId(id); - return new ManagedClusterUpgradeProfileResource(Client, id); + AutoUpgradeProfileResource.ValidateResourceId(id); + return new AutoUpgradeProfileResource(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. + /// 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 ContainerServiceManagedClusterResource GetContainerServiceManagedClusterResource(ResourceIdentifier id) + /// Returns a object. + public virtual FleetMemberResource GetFleetMemberResource(ResourceIdentifier id) { - ContainerServiceManagedClusterResource.ValidateResourceId(id); - return new ContainerServiceManagedClusterResource(Client, id); + FleetMemberResource.ValidateResourceId(id); + return new FleetMemberResource(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. + /// 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 MeshRevisionProfileResource GetMeshRevisionProfileResource(ResourceIdentifier id) + /// Returns a object. + public virtual UpdateRunResource GetUpdateRunResource(ResourceIdentifier id) { - MeshRevisionProfileResource.ValidateResourceId(id); - return new MeshRevisionProfileResource(Client, id); + UpdateRunResource.ValidateResourceId(id); + return new UpdateRunResource(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. + /// 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 MeshUpgradeProfileResource GetMeshUpgradeProfileResource(ResourceIdentifier id) + /// Returns a object. + public virtual FleetUpdateStrategyResource GetFleetUpdateStrategyResource(ResourceIdentifier id) { - MeshUpgradeProfileResource.ValidateResourceId(id); - return new MeshUpgradeProfileResource(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 ContainerServiceMaintenanceConfigurationResource GetContainerServiceMaintenanceConfigurationResource(ResourceIdentifier id) - { - ContainerServiceMaintenanceConfigurationResource.ValidateResourceId(id); - 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 ContainerServiceAgentPoolResource GetContainerServiceAgentPoolResource(ResourceIdentifier id) - { - ContainerServiceAgentPoolResource.ValidateResourceId(id); - return new ContainerServiceAgentPoolResource(Client, id); - } - - /// - /// 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 AgentPoolUpgradeProfileResource GetAgentPoolUpgradeProfileResource(ResourceIdentifier id) - { - AgentPoolUpgradeProfileResource.ValidateResourceId(id); - 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 ContainerServicePrivateEndpointConnectionResource GetContainerServicePrivateEndpointConnectionResource(ResourceIdentifier id) - { - ContainerServicePrivateEndpointConnectionResource.ValidateResourceId(id); - return new ContainerServicePrivateEndpointConnectionResource(Client, id); - } - - /// - /// 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 AgentPoolSnapshotResource GetAgentPoolSnapshotResource(ResourceIdentifier id) - { - AgentPoolSnapshotResource.ValidateResourceId(id); - 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 ContainerServiceTrustedAccessRoleBindingResource GetContainerServiceTrustedAccessRoleBindingResource(ResourceIdentifier id) - { - ContainerServiceTrustedAccessRoleBindingResource.ValidateResourceId(id); - return new ContainerServiceTrustedAccessRoleBindingResource(Client, id); + FleetUpdateStrategyResource.ValidateResourceId(id); + return new FleetUpdateStrategyResource(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..88e51542accf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceResourceGroupResource.cs @@ -33,142 +33,73 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// Gets a collection of ContainerServiceManagedClusterResources in the ResourceGroupResource. - /// An object representing collection of ContainerServiceManagedClusterResources and their operations over a ContainerServiceManagedClusterResource. - public virtual ContainerServiceManagedClusterCollection GetContainerServiceManagedClusters() + /// Gets a collection of FleetResources in the ResourceGroupResource. + /// An object representing collection of FleetResources and their operations over a FleetResource. + public virtual FleetCollection GetFleets() { - return GetCachedClient(client => new ContainerServiceManagedClusterCollection(client, Id)); + return GetCachedClient(client => new FleetCollection(client, Id)); } /// - /// Gets a managed cluster. + /// Gets a Fleet. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} /// /// /// Operation Id - /// ManagedClusters_Get + /// Fleets_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of the managed cluster resource. + /// The name of the Fleet resource. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetContainerServiceManagedClusterAsync(string resourceName, CancellationToken cancellationToken = default) + public virtual async Task> GetFleetAsync(string fleetName, CancellationToken cancellationToken = default) { - return await GetContainerServiceManagedClusters().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); + return await GetFleets().GetAsync(fleetName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a managed cluster. + /// Gets a Fleet. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} /// /// /// Operation Id - /// ManagedClusters_Get + /// Fleets_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// - /// The name of the managed cluster resource. + /// The name of the Fleet resource. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. + /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetContainerServiceManagedCluster(string resourceName, CancellationToken cancellationToken = default) + public virtual Response GetFleet(string fleetName, CancellationToken cancellationToken = default) { - return GetContainerServiceManagedClusters().Get(resourceName, cancellationToken); - } - - /// Gets a collection of AgentPoolSnapshotResources in the ResourceGroupResource. - /// An object representing collection of AgentPoolSnapshotResources and their operations over a AgentPoolSnapshotResource. - public virtual AgentPoolSnapshotCollection GetAgentPoolSnapshots() - { - return GetCachedClient(client => new AgentPoolSnapshotCollection(client, Id)); - } - - /// - /// Gets a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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> GetAgentPoolSnapshotAsync(string resourceName, CancellationToken cancellationToken = default) - { - return await GetAgentPoolSnapshots().GetAsync(resourceName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a snapshot. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/snapshots/{resourceName} - /// - /// - /// Operation Id - /// Snapshots_Get - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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 GetAgentPoolSnapshot(string resourceName, CancellationToken cancellationToken = default) - { - return GetAgentPoolSnapshots().Get(resourceName, cancellationToken); + return GetFleets().Get(fleetName, 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..4f53266f6dc8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Extensions/MockableContainerServiceSubscriptionResource.cs @@ -5,27 +5,18 @@ #nullable disable -using System; using System.Threading; -using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.ContainerService.Models; namespace Azure.ResourceManager.ContainerService.Mocking { /// A class to add extension methods to SubscriptionResource. public partial class MockableContainerServiceSubscriptionResource : ArmResource { - private ClientDiagnostics _managedClustersClientDiagnostics; - private ManagedClustersRestOperations _managedClustersRestClient; - private ClientDiagnostics _containerServiceManagedClusterManagedClustersClientDiagnostics; - private ManagedClustersRestOperations _containerServiceManagedClusterManagedClustersRestClient; - private ClientDiagnostics _agentPoolSnapshotSnapshotsClientDiagnostics; - private SnapshotsRestOperations _agentPoolSnapshotSnapshotsRestClient; - private ClientDiagnostics _trustedAccessRolesClientDiagnostics; - private TrustedAccessRolesRestOperations _trustedAccessRolesRestClient; + private ClientDiagnostics _fleetClientDiagnostics; + private FleetsRestOperations _fleetRestClient; /// Initializes a new instance of the class for mocking. protected MockableContainerServiceSubscriptionResource() @@ -39,14 +30,8 @@ internal MockableContainerServiceSubscriptionResource(ArmClient client, Resource { } - private ClientDiagnostics ManagedClustersClientDiagnostics => _managedClustersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - 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 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 TrustedAccessRolesClientDiagnostics => _trustedAccessRolesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private TrustedAccessRolesRestOperations TrustedAccessRolesRestClient => _trustedAccessRolesRestClient ??= new TrustedAccessRolesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics FleetClientDiagnostics => _fleetClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ContainerService", FleetResource.ResourceType.Namespace, Diagnostics); + private FleetsRestOperations FleetRestClient => _fleetRestClient ??= new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(FleetResource.ResourceType)); private string GetApiVersionOrNull(ResourceType resourceType) { @@ -54,320 +39,64 @@ private string GetApiVersionOrNull(ResourceType resourceType) return apiVersion; } - /// 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. - public virtual MeshRevisionProfileCollection GetMeshRevisionProfiles(AzureLocation location) - { - return new MeshRevisionProfileCollection(Client, Id, location); - } - - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the Azure region. - /// The mode of the mesh. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetMeshRevisionProfileAsync(AzureLocation location, string mode, CancellationToken cancellationToken = default) - { - return await GetMeshRevisionProfiles(location).GetAsync(mode, cancellationToken).ConfigureAwait(false); - } - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades + /// Lists fleets in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets /// /// /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile + /// Fleets_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// - /// - /// - /// - /// The name of the Azure region. - /// The mode of the mesh. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetMeshRevisionProfile(AzureLocation location, string mode, CancellationToken cancellationToken = default) - { - return GetMeshRevisionProfiles(location).Get(mode, cancellationToken); - } - - /// - /// Contains extra metadata on the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the version - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions - /// - /// - /// Operation Id - /// ManagedClusters_ListKubernetesVersions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// The name of the Azure region. - /// The cancellation token to use. - public virtual async Task> GetKubernetesVersionsManagedClusterAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - using var scope = ManagedClustersClientDiagnostics.CreateScope("MockableContainerServiceSubscriptionResource.GetKubernetesVersionsManagedCluster"); - scope.Start(); - try - { - var response = await ManagedClustersRestClient.ListKubernetesVersionsAsync(Id.SubscriptionId, location, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Contains extra metadata on the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the version - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/kubernetesVersions - /// - /// - /// Operation Id - /// ManagedClusters_ListKubernetesVersions - /// - /// - /// Default Api Version - /// 2023-10-01 + /// /// /// /// - /// The name of the Azure region. /// The cancellation token to use. - public virtual Response GetKubernetesVersionsManagedCluster(AzureLocation location, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetFleetsAsync(CancellationToken cancellationToken = default) { - using var scope = ManagedClustersClientDiagnostics.CreateScope("MockableContainerServiceSubscriptionResource.GetKubernetesVersionsManagedCluster"); - scope.Start(); - try - { - var response = ManagedClustersRestClient.ListKubernetesVersions(Id.SubscriptionId, location, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => FleetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FleetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FleetResource(Client, FleetData.DeserializeFleetData(e)), FleetClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetFleets", "value", "nextLink", cancellationToken); } /// - /// Gets a list of managed clusters in the specified subscription. + /// Lists fleets in the specified subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters + /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/fleets /// /// /// Operation Id - /// ManagedClusters_List + /// Fleets_ListBySubscription /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetContainerServiceManagedClustersAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of managed clusters in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/managedClusters - /// - /// - /// Operation Id - /// ManagedClusters_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetContainerServiceManagedClusters(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerServiceManagedClusterManagedClustersRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerServiceManagedClusterResource(Client, ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(e)), ContainerServiceManagedClusterManagedClustersClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetContainerServiceManagedClusters", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetAgentPoolSnapshotsAsync(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of snapshots in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/snapshots - /// - /// - /// Operation Id - /// Snapshots_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetAgentPoolSnapshots(CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => AgentPoolSnapshotSnapshotsRestClient.CreateListRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgentPoolSnapshotSnapshotsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgentPoolSnapshotResource(Client, AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(e)), AgentPoolSnapshotSnapshotsClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetAgentPoolSnapshots", "value", "nextLink", cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// - /// 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 GetTrustedAccessRolesAsync(AzureLocation location, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole(e), TrustedAccessRolesClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); - } - - /// - /// List supported trusted access roles. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/trustedAccessRoles - /// - /// - /// Operation Id - /// TrustedAccessRoles_List - /// - /// - /// Default Api Version - /// 2023-10-01 + /// /// /// /// - /// 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 GetTrustedAccessRoles(AzureLocation location, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetFleets(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => TrustedAccessRolesRestClient.CreateListRequest(Id.SubscriptionId, location); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => TrustedAccessRolesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole(e), TrustedAccessRolesClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetTrustedAccessRoles", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => FleetRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FleetRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FleetResource(Client, FleetData.DeserializeFleetData(e)), FleetClientDiagnostics, Pipeline, "MockableContainerServiceSubscriptionResource.GetFleets", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetCollection.cs new file mode 100644 index 000000000000..d9fe46718e99 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetCollection.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 GetFleets method from an instance of . + /// + public partial class FleetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _fleetClientDiagnostics; + private readonly FleetsRestOperations _fleetRestClient; + + /// Initializes a new instance of the class for mocking. + protected FleetCollection() + { + } + + /// 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 FleetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fleetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", FleetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(FleetResource.ResourceType, out string fleetApiVersion); + _fleetRestClient = new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetApiVersion); +#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 Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 Fleet resource. + /// Resource create parameters. + /// 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 fleetName, FleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _fleetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetOperationSource(Client), _fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates or updates a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 Fleet resource. + /// Resource create parameters. + /// 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 fleetName, FleetData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _fleetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetOperationSource(Client), _fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, fleetName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.Get"); + scope.Start(); + try + { + var response = await _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.Get"); + scope.Start(); + try + { + var response = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FleetResource(Client, FleetData.DeserializeFleetData(e)), _fleetClientDiagnostics, Pipeline, "FleetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists fleets in the specified subscription and resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets + /// + /// + /// Operation Id + /// Fleets_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FleetResource(Client, FleetData.DeserializeFleetData(e)), _fleetClientDiagnostics, Pipeline, "FleetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.Exists"); + scope.Start(); + try + { + var response = await _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, 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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.Exists"); + scope.Start(); + try + { + var response = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, 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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet 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 fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetResource(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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, fleetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetResource(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/Models/ManagedClusterAccessProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.Serialization.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.Serialization.cs index e02f0832bf63..821ce12e09f6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.Serialization.cs @@ -12,15 +12,16 @@ using System.Text; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.ContainerService.Models +namespace Azure.ResourceManager.ContainerService { - public partial class ManagedClusterAccessProfile : IUtf8JsonSerializable, IJsonModel + public partial class FleetData : 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); @@ -31,36 +32,56 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(ManagedClusterAccessProfile)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetData)} 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(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsDefined(KubeConfig)) + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(HubProfile)) + { + writer.WritePropertyName("hubProfile"u8); + writer.WriteObjectValue(HubProfile, options); + } + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("kubeConfig"u8); - writer.WriteBase64StringValue(KubeConfig, "D"); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } writer.WriteEndObject(); } - ManagedClusterAccessProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetData 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(ManagedClusterAccessProfile)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAccessProfile(document.RootElement, options); + return DeserializeFleetData(document.RootElement, options); } - internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfile(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetData DeserializeFleetData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -68,17 +89,39 @@ internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfi { return null; } + ETag? etag = default; + ResourceManager.Models.ManagedServiceIdentity identity = default; IDictionary tags = default; AzureLocation location = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - byte[] kubeConfig = default; + FleetProvisioningState? provisioningState = default; + FleetHubProfile hubProfile = default; + FleetStatus 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("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (property.NameEquals("tags"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -131,13 +174,31 @@ internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfi } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("kubeConfig"u8)) + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FleetProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("hubProfile"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - kubeConfig = property0.Value.GetBytesFromBase64("D"); + hubProfile = FleetHubProfile.DeserializeFleetHubProfile(property0.Value, options); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetStatus.DeserializeFleetStatus(property0.Value, options); continue; } } @@ -149,14 +210,18 @@ internal static ManagedClusterAccessProfile DeserializeManagedClusterAccessProfi } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAccessProfile( + return new FleetData( id, name, type, systemData, tags ?? new ChangeTrackingDictionary(), location, - kubeConfig, + etag, + identity, + provisioningState, + hubProfile, + status, serializedAdditionalRawData); } @@ -243,6 +308,36 @@ 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(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: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); if (hasPropertyOverride) { @@ -275,18 +370,48 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeConfig), out propertyOverride); + 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(HubProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hubProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HubProfile)) + { + builder.Append(" hubProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, HubProfile, options, 4, false, " hubProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" kubeConfig: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(KubeConfig)) + if (Optional.IsDefined(Status)) { - builder.Append(" kubeConfig: "); - builder.AppendLine($"'{KubeConfig.ToString()}'"); + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 4, false, " status: "); } } @@ -295,9 +420,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -306,26 +431,26 @@ BinaryData IPersistableModel.Write(ModelReaderWrite case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterAccessProfile)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetData)} does not support writing '{options.Format}' format."); } } - ManagedClusterAccessProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetData 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); - return DeserializeManagedClusterAccessProfile(document.RootElement, options); + return DeserializeFleetData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterAccessProfile)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetData)} 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/FleetData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.cs new file mode 100644 index 000000000000..c8b50d56d5ee --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetData.cs @@ -0,0 +1,104 @@ +// 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 Fleet data model. + /// The Fleet resource. + /// + public partial class FleetData : 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 FleetData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// Managed identity. + /// The status of the last operation. + /// The FleetHubProfile configures the Fleet's hub. + /// Status information for the fleet. + /// Keeps track of any properties unknown to the library. + internal FleetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ETag? etag, ResourceManager.Models.ManagedServiceIdentity identity, FleetProvisioningState? provisioningState, FleetHubProfile hubProfile, FleetStatus status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ETag = etag; + Identity = identity; + ProvisioningState = provisioningState; + HubProfile = hubProfile; + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FleetData() + { + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + [WirePath("eTag")] + public ETag? ETag { get; } + /// Managed identity. + [WirePath("identity")] + public ResourceManager.Models.ManagedServiceIdentity Identity { get; set; } + /// The status of the last operation. + [WirePath("properties.provisioningState")] + public FleetProvisioningState? ProvisioningState { get; } + /// The FleetHubProfile configures the Fleet's hub. + [WirePath("properties.hubProfile")] + public FleetHubProfile HubProfile { get; set; } + /// Status information for the fleet. + [WirePath("properties.status")] + public FleetStatus Status { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberCollection.cs new file mode 100644 index 000000000000..b947ecfc521f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberCollection.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 GetFleetMembers method from an instance of . + /// + public partial class FleetMemberCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _fleetMemberClientDiagnostics; + private readonly FleetMembersRestOperations _fleetMemberRestClient; + + /// Initializes a new instance of the class for mocking. + protected FleetMemberCollection() + { + } + + /// 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 FleetMemberCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fleetMemberClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", FleetMemberResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(FleetMemberResource.ResourceType, out string fleetMemberApiVersion); + _fleetMemberRestClient = new FleetMembersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetMemberApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != FleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, FleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Create + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 Fleet member resource. + /// Resource create parameters. + /// 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 fleetMemberName, FleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _fleetMemberRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetMemberOperationSource(Client), _fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Create + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 Fleet member resource. + /// Resource create parameters. + /// 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 fleetMemberName, FleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _fleetMemberRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetMemberOperationSource(Client), _fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.Get"); + scope.Start(); + try + { + var response = await _fleetMemberRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.Get"); + scope.Start(); + try + { + var response = _fleetMemberRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List FleetMember resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members + /// + /// + /// Operation Id + /// FleetMembers_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetMemberRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetMemberRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FleetMemberResource(Client, FleetMemberData.DeserializeFleetMemberData(e)), _fleetMemberClientDiagnostics, Pipeline, "FleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List FleetMember resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members + /// + /// + /// Operation Id + /// FleetMembers_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetMemberRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetMemberRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FleetMemberResource(Client, FleetMemberData.DeserializeFleetMemberData(e)), _fleetMemberClientDiagnostics, Pipeline, "FleetMemberCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.Exists"); + scope.Start(); + try + { + var response = await _fleetMemberRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, 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/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.Exists"); + scope.Start(); + try + { + var response = _fleetMemberRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, 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/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member 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 fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fleetMemberRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(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/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fleetMemberRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, fleetMemberName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(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/AgentPoolUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.Serialization.cs similarity index 51% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.Serialization.cs index 8c89c84e94ee..cc2558b704e6 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/AgentPoolUpgradeProfileData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.Serialization.cs @@ -17,11 +17,11 @@ namespace Azure.ResourceManager.ContainerService { - public partial class AgentPoolUpgradeProfileData : IUtf8JsonSerializable, IJsonModel + public partial class FleetMemberData : 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,50 +32,67 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(AgentPoolUpgradeProfileData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberData)} 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()); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType.ToString()); - if (Optional.IsCollectionDefined(Upgrades)) + if (Optional.IsDefined(ClusterResourceId)) { - writer.WritePropertyName("upgrades"u8); - writer.WriteStartArray(); - foreach (var item in Upgrades) + writer.WritePropertyName("clusterResourceId"u8); + writer.WriteStringValue(ClusterResourceId); + } + if (Optional.IsDefined(Group)) + { + writer.WritePropertyName("group"u8); + writer.WriteStringValue(Group); + } + 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.WriteObjectValue(item, options); + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); } - writer.WriteEndArray(); + writer.WriteEndObject(); } - if (Optional.IsDefined(LatestNodeImageVersion)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("latestNodeImageVersion"u8); - writer.WriteStringValue(LatestNodeImageVersion); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } writer.WriteEndObject(); } - AgentPoolUpgradeProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetMemberData 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(AgentPoolUpgradeProfileData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolUpgradeProfileData(document.RootElement, options); + return DeserializeFleetMemberData(document.RootElement, options); } - internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileData(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetMemberData DeserializeFleetMemberData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,18 +100,29 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa { return null; } + ETag? etag = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - string kubernetesVersion = default; - ContainerServiceOSType osType = default; - IReadOnlyList upgrades = default; - string latestNodeImageVersion = default; + ResourceIdentifier clusterResourceId = default; + string group = default; + FleetMemberProvisioningState? provisioningState = default; + IDictionary labels = default; + FleetMemberStatus 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("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -128,33 +156,50 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("kubernetesVersion"u8)) + if (property0.NameEquals("clusterResourceId"u8)) { - kubernetesVersion = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clusterResourceId = new ResourceIdentifier(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("group"u8)) + { + group = property0.Value.GetString(); continue; } - if (property0.NameEquals("osType"u8)) + if (property0.NameEquals("provisioningState"u8)) { - osType = new ContainerServiceOSType(property0.Value.GetString()); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new FleetMemberProvisioningState(property0.Value.GetString()); continue; } - if (property0.NameEquals("upgrades"u8)) + if (property0.NameEquals("labels"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) { - array.Add(AgentPoolUpgradeProfilePropertiesUpgradesItem.DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(item, options)); + dictionary.Add(property1.Name, property1.Value.GetString()); } - upgrades = array; + labels = dictionary; continue; } - if (property0.NameEquals("latestNodeImageVersion"u8)) + if (property0.NameEquals("status"u8)) { - latestNodeImageVersion = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = FleetMemberStatus.DeserializeFleetMemberStatus(property0.Value, options); continue; } } @@ -166,15 +211,17 @@ internal static AgentPoolUpgradeProfileData DeserializeAgentPoolUpgradeProfileDa } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolUpgradeProfileData( + return new FleetMemberData( id, name, type, systemData, - kubernetesVersion, - osType, - upgrades ?? new ChangeTrackingList(), - latestNodeImageVersion, + etag, + clusterResourceId, + group, + provisioningState, + labels ?? new ChangeTrackingDictionary(), + status, serializedAdditionalRawData); } @@ -212,6 +259,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(Id), out propertyOverride); if (hasPropertyOverride) { @@ -244,84 +306,108 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClusterResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clusterResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClusterResourceId)) + { + builder.Append(" clusterResourceId: "); + builder.AppendLine($"'{ClusterResourceId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Group), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" kubernetesVersion: "); + builder.Append(" group: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(KubernetesVersion)) + if (Optional.IsDefined(Group)) { - builder.Append(" kubernetesVersion: "); - if (KubernetesVersion.Contains(Environment.NewLine)) + builder.Append(" group: "); + if (Group.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{KubernetesVersion}'''"); + builder.AppendLine($"{Group}'''"); } else { - builder.AppendLine($"'{KubernetesVersion}'"); + builder.AppendLine($"'{Group}'"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" osType: "); + builder.Append(" provisioningState: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.ToString()}'"); + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Upgrades), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Labels), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" upgrades: "); + builder.Append(" labels: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(Upgrades)) + if (Optional.IsCollectionDefined(Labels)) { - if (Upgrades.Any()) + if (Labels.Any()) { - builder.Append(" upgrades: "); - builder.AppendLine("["); - foreach (var item in Upgrades) + builder.Append(" labels: "); + builder.AppendLine("{"); + foreach (var item in Labels) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " upgrades: "); + 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(" }"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestNodeImageVersion), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" latestNodeImageVersion: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(LatestNodeImageVersion)) + if (Optional.IsDefined(Status)) { - builder.Append(" latestNodeImageVersion: "); - if (LatestNodeImageVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{LatestNodeImageVersion}'''"); - } - else - { - builder.AppendLine($"'{LatestNodeImageVersion}'"); - } + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 4, false, " status: "); } } @@ -330,9 +416,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -341,26 +427,26 @@ BinaryData IPersistableModel.Write(ModelReaderWrite case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(AgentPoolUpgradeProfileData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberData)} does not support writing '{options.Format}' format."); } } - AgentPoolUpgradeProfileData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetMemberData 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); - return DeserializeAgentPoolUpgradeProfileData(document.RootElement, options); + return DeserializeFleetMemberData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AgentPoolUpgradeProfileData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberData)} 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/FleetMemberData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.cs new file mode 100644 index 000000000000..e123f515304d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberData.cs @@ -0,0 +1,102 @@ +// 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 FleetMember data model. + /// A member of the Fleet. It contains a reference to an existing Kubernetes cluster on Azure. + /// + public partial class FleetMemberData : 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 FleetMemberData() + { + Labels = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + /// The group this member belongs to for multi-cluster update management. + /// The status of the last operation. + /// The labels for the fleet member. + /// Status information of the last operation for fleet member. + /// Keeps track of any properties unknown to the library. + internal FleetMemberData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, ResourceIdentifier clusterResourceId, string group, FleetMemberProvisioningState? provisioningState, IDictionary labels, FleetMemberStatus status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + ClusterResourceId = clusterResourceId; + Group = group; + ProvisioningState = provisioningState; + Labels = labels; + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + [WirePath("eTag")] + public ETag? ETag { get; } + /// The ARM resource id of the cluster that joins the Fleet. Must be a valid Azure resource id. e.g.: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{clusterName}'. + [WirePath("properties.clusterResourceId")] + public ResourceIdentifier ClusterResourceId { get; set; } + /// The group this member belongs to for multi-cluster update management. + [WirePath("properties.group")] + public string Group { get; set; } + /// The status of the last operation. + [WirePath("properties.provisioningState")] + public FleetMemberProvisioningState? ProvisioningState { get; } + /// The labels for the fleet member. + [WirePath("properties.labels")] + public IDictionary Labels { get; } + /// Status information of the last operation for fleet member. + [WirePath("properties.status")] + public FleetMemberStatus Status { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.Serialization.cs new file mode 100644 index 000000000000..bc76426a3b0d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.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 FleetMemberResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + FleetMemberData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + FleetMemberData 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/ContainerServiceMaintenanceConfigurationResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.cs similarity index 50% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.cs index f1463e991c78..d6c0bf203ef1 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceMaintenanceConfigurationResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetMemberResource.cs @@ -11,57 +11,58 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.ContainerService.Models; namespace Azure.ResourceManager.ContainerService { /// - /// A Class representing a ContainerServiceMaintenanceConfiguration 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 GetContainerServiceMaintenanceConfigurationResource method. - /// Otherwise you can get one from its parent resource using the GetContainerServiceMaintenanceConfiguration method. + /// A Class representing a FleetMember 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 GetFleetMemberResource method. + /// Otherwise you can get one from its parent resource using the GetFleetMember method. /// - public partial class ContainerServiceMaintenanceConfigurationResource : ArmResource + public partial class FleetMemberResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. - /// The resourceName. - /// The configName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string configName) + /// The fleetName. + /// The fleetMemberName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics; - private readonly MaintenanceConfigurationsRestOperations _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient; - private readonly ContainerServiceMaintenanceConfigurationData _data; + private readonly ClientDiagnostics _fleetMemberClientDiagnostics; + private readonly FleetMembersRestOperations _fleetMemberRestClient; + private readonly FleetMemberData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/maintenanceConfigurations"; + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/members"; - /// Initializes a new instance of the class for mocking. - protected ContainerServiceMaintenanceConfigurationResource() + /// Initializes a new instance of the class for mocking. + protected FleetMemberResource() { } - /// 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 ContainerServiceMaintenanceConfigurationResource(ArmClient client, ContainerServiceMaintenanceConfigurationData data) : this(client, data.Id) + internal FleetMemberResource(ArmClient client, FleetMemberData 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 ContainerServiceMaintenanceConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal FleetMemberResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string containerServiceMaintenanceConfigurationMaintenanceConfigurationsApiVersion); - _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient = new MaintenanceConfigurationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServiceMaintenanceConfigurationMaintenanceConfigurationsApiVersion); + _fleetMemberClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string fleetMemberApiVersion); + _fleetMemberRestClient = new FleetMembersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetMemberApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +73,7 @@ internal ContainerServiceMaintenanceConfigurationResource(ArmClient client, Reso /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ContainerServiceMaintenanceConfigurationData Data + public virtual FleetMemberData Data { get { @@ -89,37 +90,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// Gets the specified maintenance configuration of a managed cluster. + /// Get a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_Get + /// FleetMembers_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Get"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Get"); scope.Start(); try { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _fleetMemberRestClient.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 ContainerServiceMaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,37 +130,37 @@ public virtual async Task - /// Gets the specified maintenance configuration of a managed cluster. + /// Get a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_Get + /// FleetMembers_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Get"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Get"); scope.Start(); try { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _fleetMemberRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServiceMaintenanceConfigurationResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new FleetMemberResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,38 +170,37 @@ public virtual Response Get(Ca } /// - /// Deletes a maintenance configuration. + /// Delete a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_Delete + /// FleetMembers_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Delete"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Delete"); scope.Start(); try { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(response, rehydrationToken); + var response = await _fleetMemberRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -213,38 +213,37 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes a maintenance configuration. + /// Delete a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_Delete + /// FleetMembers_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Delete"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Delete"); scope.Start(); try { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); - var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); - var operation = new ContainerServiceArmOperation(response, rehydrationToken); + var response = _fleetMemberRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -257,42 +256,41 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Creates or updates a maintenance configuration in the specified managed cluster. + /// Update a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_CreateOrUpdate + /// FleetMembers_Update /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 maintenance configuration to create or update. + /// The resource properties to be updated. + /// 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, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, FleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Update"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Update"); scope.Start(); try { - var response = await _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.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 ContainerServiceMaintenanceConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var response = await _fleetMemberRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetMemberOperationSource(Client), _fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.OriginalUri); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -305,42 +303,41 @@ public virtual async Task - /// Creates or updates a maintenance configuration in the specified managed cluster. + /// Update a FleetMember /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/maintenanceConfigurations/{configName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} /// /// /// Operation Id - /// MaintenanceConfigurations_CreateOrUpdate + /// FleetMembers_Update /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 maintenance configuration to create or update. + /// The resource properties to be updated. + /// The request should only proceed if an entity matches this string. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, FleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsClientDiagnostics.CreateScope("ContainerServiceMaintenanceConfigurationResource.Update"); + using var scope = _fleetMemberClientDiagnostics.CreateScope("FleetMemberResource.Update"); scope.Start(); try { - var response = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _containerServiceMaintenanceConfigurationMaintenanceConfigurationsRestClient.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 ContainerServiceMaintenanceConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + var response = _fleetMemberRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetMemberOperationSource(Client), _fleetMemberClientDiagnostics, Pipeline, _fleetMemberRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.OriginalUri); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.Serialization.cs new file mode 100644 index 000000000000..8c4be483849d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.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 FleetResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + FleetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + FleetData 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/FleetResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.cs new file mode 100644 index 000000000000..4577dcdd3f54 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetResource.cs @@ -0,0 +1,1063 @@ +// 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 Fleet 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 GetFleetResource method. + /// Otherwise you can get one from its parent resource using the GetFleet method. + /// + public partial class FleetResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _fleetClientDiagnostics; + private readonly FleetsRestOperations _fleetRestClient; + private readonly FleetData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets"; + + /// Initializes a new instance of the class for mocking. + protected FleetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal FleetResource(ArmClient client, FleetData 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 FleetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fleetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string fleetApiVersion); + _fleetRestClient = new FleetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetApiVersion); +#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 FleetData 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 collection of AutoUpgradeProfileResources in the Fleet. + /// An object representing collection of AutoUpgradeProfileResources and their operations over a AutoUpgradeProfileResource. + public virtual AutoUpgradeProfileCollection GetAutoUpgradeProfiles() + { + return GetCachedClient(client => new AutoUpgradeProfileCollection(client, Id)); + } + + /// + /// Get a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAutoUpgradeProfileAsync(string autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + return await GetAutoUpgradeProfiles().GetAsync(autoUpgradeProfileName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AutoUpgradeProfile + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/autoUpgradeProfiles/{autoUpgradeProfileName} + /// + /// + /// Operation Id + /// AutoUpgradeProfiles_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AutoUpgradeProfile resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAutoUpgradeProfile(string autoUpgradeProfileName, CancellationToken cancellationToken = default) + { + return GetAutoUpgradeProfiles().Get(autoUpgradeProfileName, cancellationToken); + } + + /// Gets a collection of FleetMemberResources in the Fleet. + /// An object representing collection of FleetMemberResources and their operations over a FleetMemberResource. + public virtual FleetMemberCollection GetFleetMembers() + { + return GetCachedClient(client => new FleetMemberCollection(client, Id)); + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFleetMemberAsync(string fleetMemberName, CancellationToken cancellationToken = default) + { + return await GetFleetMembers().GetAsync(fleetMemberName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FleetMember + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/members/{fleetMemberName} + /// + /// + /// Operation Id + /// FleetMembers_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Fleet member resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFleetMember(string fleetMemberName, CancellationToken cancellationToken = default) + { + return GetFleetMembers().Get(fleetMemberName, cancellationToken); + } + + /// Gets a collection of UpdateRunResources in the Fleet. + /// An object representing collection of UpdateRunResources and their operations over a UpdateRunResource. + public virtual UpdateRunCollection GetUpdateRuns() + { + return GetCachedClient(client => new UpdateRunCollection(client, Id)); + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetUpdateRunAsync(string updateRunName, CancellationToken cancellationToken = default) + { + return await GetUpdateRuns().GetAsync(updateRunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetUpdateRun(string updateRunName, CancellationToken cancellationToken = default) + { + return GetUpdateRuns().Get(updateRunName, cancellationToken); + } + + /// Gets a collection of FleetUpdateStrategyResources in the Fleet. + /// An object representing collection of FleetUpdateStrategyResources and their operations over a FleetUpdateStrategyResource. + public virtual FleetUpdateStrategyCollection GetFleetUpdateStrategies() + { + return GetCachedClient(client => new FleetUpdateStrategyCollection(client, Id)); + } + + /// + /// Get a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetFleetUpdateStrategyAsync(string updateStrategyName, CancellationToken cancellationToken = default) + { + return await GetFleetUpdateStrategies().GetAsync(updateStrategyName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetFleetUpdateStrategy(string updateStrategyName, CancellationToken cancellationToken = default) + { + return GetFleetUpdateStrategies().Get(updateStrategyName, cancellationToken); + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Get"); + scope.Start(); + try + { + var response = await _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Get"); + scope.Start(); + try + { + var response = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Delete"); + scope.Start(); + try + { + var response = await _fleetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Delete"); + scope.Start(); + try + { + var response = _fleetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Update + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 resource properties to be updated. + /// 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, FleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Update"); + scope.Start(); + try + { + var response = await _fleetRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetOperationSource(Client), _fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.OriginalUri); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Update + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 resource properties to be updated. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, FleetPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.Update"); + scope.Start(); + try + { + var response = _fleetRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetOperationSource(Client), _fleetClientDiagnostics, Pipeline, _fleetRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, ifMatch).Request, response, OperationFinalStateVia.OriginalUri); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials + /// + /// + /// Operation Id + /// Fleets_ListCredentials + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetCredentialsAsync(CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.GetCredentials"); + scope.Start(); + try + { + var response = await _fleetRestClient.ListCredentialsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the user credentials of a Fleet. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/listCredentials + /// + /// + /// Operation Id + /// Fleets_ListCredentials + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetCredentials(CancellationToken cancellationToken = default) + { + using var scope = _fleetClientDiagnostics.CreateScope("FleetResource.GetCredentials"); + scope.Start(); + try + { + var response = _fleetRestClient.ListCredentials(Id.SubscriptionId, Id.ResourceGroupName, 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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + 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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FleetPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + 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/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FleetPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 _fleetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new FleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName} + /// + /// + /// Operation Id + /// Fleets_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 = _fleetClientDiagnostics.CreateScope("FleetResource.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 = _fleetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new FleetResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new FleetPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyCollection.cs new file mode 100644 index 000000000000..1fa53af4295e --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyCollection.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 GetFleetUpdateStrategies method from an instance of . + /// + public partial class FleetUpdateStrategyCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _fleetUpdateStrategyClientDiagnostics; + private readonly FleetUpdateStrategiesRestOperations _fleetUpdateStrategyRestClient; + + /// Initializes a new instance of the class for mocking. + protected FleetUpdateStrategyCollection() + { + } + + /// 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 FleetUpdateStrategyCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _fleetUpdateStrategyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", FleetUpdateStrategyResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(FleetUpdateStrategyResource.ResourceType, out string fleetUpdateStrategyApiVersion); + _fleetUpdateStrategyRestClient = new FleetUpdateStrategiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetUpdateStrategyApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != FleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, FleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 UpdateStrategy resource. + /// Resource create parameters. + /// 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 updateStrategyName, FleetUpdateStrategyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _fleetUpdateStrategyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetUpdateStrategyOperationSource(Client), _fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 UpdateStrategy resource. + /// Resource create parameters. + /// 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 updateStrategyName, FleetUpdateStrategyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _fleetUpdateStrategyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetUpdateStrategyOperationSource(Client), _fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy 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 updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.Get"); + scope.Start(); + try + { + var response = await _fleetUpdateStrategyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a FleetUpdateStrategy + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.Get"); + scope.Start(); + try + { + var response = _fleetUpdateStrategyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List FleetUpdateStrategy resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies + /// + /// + /// Operation Id + /// FleetUpdateStrategies_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetUpdateStrategyRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetUpdateStrategyRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new FleetUpdateStrategyResource(Client, FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(e)), _fleetUpdateStrategyClientDiagnostics, Pipeline, "FleetUpdateStrategyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List FleetUpdateStrategy resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies + /// + /// + /// Operation Id + /// FleetUpdateStrategies_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _fleetUpdateStrategyRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _fleetUpdateStrategyRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new FleetUpdateStrategyResource(Client, FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(e)), _fleetUpdateStrategyClientDiagnostics, Pipeline, "FleetUpdateStrategyCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy 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 updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.Exists"); + scope.Start(); + try + { + var response = await _fleetUpdateStrategyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, 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/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.Exists"); + scope.Start(); + try + { + var response = _fleetUpdateStrategyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, 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/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy 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 updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _fleetUpdateStrategyRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(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/fleets/{fleetName}/updateStrategies/{updateStrategyName} + /// + /// + /// Operation Id + /// FleetUpdateStrategies_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateStrategy resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string updateStrategyName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); + + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyCollection.GetIfExists"); + scope.Start(); + try + { + var response = _fleetUpdateStrategyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateStrategyName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(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/ContainerServicePrivateEndpointConnectionData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.Serialization.cs similarity index 65% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.Serialization.cs index 579e451e6350..8346644d952b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.Serialization.cs @@ -13,15 +13,14 @@ using Azure.Core; using Azure.ResourceManager.ContainerService.Models; using Azure.ResourceManager.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.ContainerService { - public partial class ContainerServicePrivateEndpointConnectionData : IUtf8JsonSerializable, IJsonModel + public partial class FleetUpdateStrategyData : 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,13 +31,18 @@ void IJsonModel.Write(Utf8JsonWri /// 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(ContainerServicePrivateEndpointConnectionData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyData)} 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()); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) @@ -46,32 +50,27 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - if (Optional.IsDefined(PrivateEndpoint)) + if (Optional.IsDefined(Strategy)) { - writer.WritePropertyName("privateEndpoint"u8); - JsonSerializer.Serialize(writer, PrivateEndpoint); - } - if (Optional.IsDefined(ConnectionState)) - { - writer.WritePropertyName("privateLinkServiceConnectionState"u8); - writer.WriteObjectValue(ConnectionState, options); + writer.WritePropertyName("strategy"u8); + writer.WriteObjectValue(Strategy, options); } writer.WriteEndObject(); } - ContainerServicePrivateEndpointConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetUpdateStrategyData 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(ContainerServicePrivateEndpointConnectionData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement, options); + return DeserializeFleetUpdateStrategyData(document.RootElement, options); } - internal static ContainerServicePrivateEndpointConnectionData DeserializeContainerServicePrivateEndpointConnectionData(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetUpdateStrategyData DeserializeFleetUpdateStrategyData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,17 +78,26 @@ internal static ContainerServicePrivateEndpointConnectionData DeserializeContain { return null; } + ETag? etag = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ContainerServicePrivateEndpointConnectionProvisioningState? provisioningState = default; - WritableSubResource privateEndpoint = default; - ContainerServicePrivateLinkServiceConnectionState privateLinkServiceConnectionState = default; + FleetUpdateStrategyProvisioningState? provisioningState = default; + UpdateRunStrategy strategy = 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("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -129,25 +137,16 @@ internal static ContainerServicePrivateEndpointConnectionData DeserializeContain { continue; } - provisioningState = new ContainerServicePrivateEndpointConnectionProvisioningState(property0.Value.GetString()); + provisioningState = new FleetUpdateStrategyProvisioningState(property0.Value.GetString()); continue; } - if (property0.NameEquals("privateEndpoint"u8)) + if (property0.NameEquals("strategy"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - privateEndpoint = JsonSerializer.Deserialize(property0.Value.GetRawText()); - continue; - } - if (property0.NameEquals("privateLinkServiceConnectionState"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceConnectionState = ContainerServicePrivateLinkServiceConnectionState.DeserializeContainerServicePrivateLinkServiceConnectionState(property0.Value, options); + strategy = UpdateRunStrategy.DeserializeUpdateRunStrategy(property0.Value, options); continue; } } @@ -159,14 +158,14 @@ internal static ContainerServicePrivateEndpointConnectionData DeserializeContain } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePrivateEndpointConnectionData( + return new FleetUpdateStrategyData( id, name, type, systemData, + etag, provisioningState, - privateEndpoint, - privateLinkServiceConnectionState, + strategy, serializedAdditionalRawData); } @@ -204,6 +203,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(Id), out propertyOverride); if (hasPropertyOverride) { @@ -251,38 +265,23 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PrivateEndpointId", out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StrategyStages", out propertyOverride); if (hasPropertyOverride) { - builder.Append(" privateEndpoint: "); + builder.Append(" strategy: "); builder.AppendLine("{"); - builder.AppendLine(" privateEndpoint: {"); - builder.Append(" id: "); + builder.AppendLine(" strategy: {"); + builder.Append(" stages: "); builder.AppendLine(propertyOverride); builder.AppendLine(" }"); builder.AppendLine(" }"); } else { - if (Optional.IsDefined(PrivateEndpoint)) - { - builder.Append(" privateEndpoint: "); - BicepSerializationHelpers.AppendChildObject(builder, PrivateEndpoint, options, 4, false, " privateEndpoint: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionState), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceConnectionState: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ConnectionState)) + if (Optional.IsDefined(Strategy)) { - builder.Append(" privateLinkServiceConnectionState: "); - BicepSerializationHelpers.AppendChildObject(builder, ConnectionState, options, 4, false, " privateLinkServiceConnectionState: "); + builder.Append(" strategy: "); + BicepSerializationHelpers.AppendChildObject(builder, Strategy, options, 4, false, " strategy: "); } } @@ -291,9 +290,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -302,26 +301,26 @@ BinaryData IPersistableModel.Writ case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServicePrivateEndpointConnectionData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyData)} does not support writing '{options.Format}' format."); } } - ContainerServicePrivateEndpointConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetUpdateStrategyData 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); - return DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement, options); + return DeserializeFleetUpdateStrategyData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServicePrivateEndpointConnectionData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyData)} 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/FleetUpdateStrategyData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.cs new file mode 100644 index 000000000000..5e174e6dc53c --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyData.cs @@ -0,0 +1,92 @@ +// 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 FleetUpdateStrategy data model. + /// Defines a multi-stage process to perform update operations across members of a Fleet. + /// + public partial class FleetUpdateStrategyData : 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 FleetUpdateStrategyData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateStrategy resource. + /// Defines the update sequence of the clusters. + /// Keeps track of any properties unknown to the library. + internal FleetUpdateStrategyData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, FleetUpdateStrategyProvisioningState? provisioningState, UpdateRunStrategy strategy, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + ProvisioningState = provisioningState; + Strategy = strategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + [WirePath("eTag")] + public ETag? ETag { get; } + /// The provisioning state of the UpdateStrategy resource. + [WirePath("properties.provisioningState")] + public FleetUpdateStrategyProvisioningState? ProvisioningState { get; } + /// Defines the update sequence of the clusters. + internal UpdateRunStrategy Strategy { get; set; } + /// The list of stages that compose this update run. Min size: 1. + [WirePath("properties.strategy.stages")] + public IList StrategyStages + { + get => Strategy is null ? default : Strategy.Stages; + set => Strategy = new UpdateRunStrategy(value); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.Serialization.cs new file mode 100644 index 000000000000..4582bb023ea3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.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 FleetUpdateStrategyResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + FleetUpdateStrategyData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + FleetUpdateStrategyData 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/ContainerServicePrivateEndpointConnectionResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.cs similarity index 52% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.cs index 56db01f3bb7c..cbad4cec6a2f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServicePrivateEndpointConnectionResource.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/FleetUpdateStrategyResource.cs @@ -15,53 +15,53 @@ namespace Azure.ResourceManager.ContainerService { /// - /// A Class representing a ContainerServicePrivateEndpointConnection 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 GetContainerServicePrivateEndpointConnectionResource method. - /// Otherwise you can get one from its parent resource using the GetContainerServicePrivateEndpointConnection method. + /// A Class representing a FleetUpdateStrategy 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 GetFleetUpdateStrategyResource method. + /// Otherwise you can get one from its parent resource using the GetFleetUpdateStrategy method. /// - public partial class ContainerServicePrivateEndpointConnectionResource : ArmResource + public partial class FleetUpdateStrategyResource : ArmResource { - /// Generate the resource identifier of a instance. + /// Generate the resource identifier of a instance. /// The subscriptionId. /// The resourceGroupName. - /// The resourceName. - /// The privateEndpointConnectionName. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) + /// The fleetName. + /// The updateStrategyName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName) { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName}"; + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName}"; return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; - private readonly PrivateEndpointConnectionsRestOperations _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient; - private readonly ContainerServicePrivateEndpointConnectionData _data; + private readonly ClientDiagnostics _fleetUpdateStrategyClientDiagnostics; + private readonly FleetUpdateStrategiesRestOperations _fleetUpdateStrategyRestClient; + private readonly FleetUpdateStrategyData _data; /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/privateEndpointConnections"; + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/updateStrategies"; - /// Initializes a new instance of the class for mocking. - protected ContainerServicePrivateEndpointConnectionResource() + /// Initializes a new instance of the class for mocking. + protected FleetUpdateStrategyResource() { } - /// 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 ContainerServicePrivateEndpointConnectionResource(ArmClient client, ContainerServicePrivateEndpointConnectionData data) : this(client, data.Id) + internal FleetUpdateStrategyResource(ArmClient client, FleetUpdateStrategyData 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 ContainerServicePrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + internal FleetUpdateStrategyResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string containerServicePrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); - _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerServicePrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); + _fleetUpdateStrategyClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string fleetUpdateStrategyApiVersion); + _fleetUpdateStrategyRestClient = new FleetUpdateStrategiesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, fleetUpdateStrategyApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -72,7 +72,7 @@ internal ContainerServicePrivateEndpointConnectionResource(ArmClient client, Res /// Gets the data representing this Feature. /// Throws if there is no data loaded in the current instance. - public virtual ContainerServicePrivateEndpointConnectionData Data + public virtual FleetUpdateStrategyData Data { get { @@ -89,37 +89,37 @@ internal static void ValidateResourceId(ResourceIdentifier id) } /// - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + /// Get a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// FleetUpdateStrategies_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Get"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Get"); scope.Start(); try { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _fleetUpdateStrategyRestClient.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 ContainerServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -129,37 +129,37 @@ public virtual async Task - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters + /// Get a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Get + /// FleetUpdateStrategies_Get /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// Resource - /// + /// /// /// /// /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) + public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Get"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Get"); scope.Start(); try { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var response = _fleetUpdateStrategyRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ContainerServicePrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + return Response.FromValue(new FleetUpdateStrategyResource(Client, response.Value), response.GetRawResponse()); } catch (Exception e) { @@ -169,36 +169,37 @@ public virtual Response Get(C } /// - /// Deletes a private endpoint connection. + /// Delete a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// FleetUpdateStrategies_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Delete"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Delete"); scope.Start(); try { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ContainerServiceArmOperation(_containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = await _fleetUpdateStrategyRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -211,36 +212,37 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Deletes a private endpoint connection. + /// Delete a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Delete + /// FleetUpdateStrategies_Delete /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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. /// The cancellation token to use. - public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) { - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Delete"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Delete"); scope.Start(); try { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - var operation = new ContainerServiceArmOperation(_containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + var response = _fleetUpdateStrategyRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -253,42 +255,42 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Updates a private endpoint connection. + /// Create a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Update + /// FleetUpdateStrategies_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 updated private endpoint connection. + /// Resource create parameters. + /// 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, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, FleetUpdateStrategyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Update"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Update"); scope.Start(); try { - var response = await _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); - var uri = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateRequestUri(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 ContainerServicePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + var response = await _fleetUpdateStrategyRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new FleetUpdateStrategyOperationSource(Client), _fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -301,42 +303,42 @@ public virtual async Task - /// Updates a private endpoint connection. + /// Create a FleetUpdateStrategy /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateStrategies/{updateStrategyName} /// /// /// Operation Id - /// PrivateEndpointConnections_Update + /// FleetUpdateStrategies_CreateOrUpdate /// /// /// Default Api Version - /// 2023-10-01 + /// 2025-03-01 /// /// /// 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 updated private endpoint connection. + /// Resource create parameters. + /// 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, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, FleetUpdateStrategyData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(data, nameof(data)); - using var scope = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("ContainerServicePrivateEndpointConnectionResource.Update"); + using var scope = _fleetUpdateStrategyClientDiagnostics.CreateScope("FleetUpdateStrategyResource.Update"); scope.Start(); try { - var response = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); - var uri = _containerServicePrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateUpdateRequestUri(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 ContainerServicePrivateEndpointConnectionResource(Client, response), response.GetRawResponse()), rehydrationToken); + var response = _fleetUpdateStrategyRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new FleetUpdateStrategyOperationSource(Client), _fleetUpdateStrategyClientDiagnostics, Pipeline, _fleetUpdateStrategyRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/AutoUpgradeProfileOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/AutoUpgradeProfileOperationSource.cs new file mode 100644 index 000000000000..b0206f7593e3 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/AutoUpgradeProfileOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class AutoUpgradeProfileOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AutoUpgradeProfileOperationSource(ArmClient client) + { + _client = client; + } + + AutoUpgradeProfileResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(document.RootElement); + return new AutoUpgradeProfileResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(document.RootElement); + return new AutoUpgradeProfileResource(_client, data); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceAgentPoolOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceAgentPoolOperationSource.cs deleted file mode 100644 index 45d44cd33b61..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceAgentPoolOperationSource.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.ContainerService -{ - internal class ContainerServiceAgentPoolOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ContainerServiceAgentPoolOperationSource(ArmClient client) - { - _client = client; - } - - ContainerServiceAgentPoolResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - var data = ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(document.RootElement); - return new ContainerServiceAgentPoolResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - var data = ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(document.RootElement); - return new ContainerServiceAgentPoolResource(_client, data); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceManagedClusterOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceManagedClusterOperationSource.cs deleted file mode 100644 index c9581509812a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceManagedClusterOperationSource.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.ContainerService -{ - internal class ContainerServiceManagedClusterOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ContainerServiceManagedClusterOperationSource(ArmClient client) - { - _client = client; - } - - ContainerServiceManagedClusterResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - var data = ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(document.RootElement); - return new ContainerServiceManagedClusterResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - var data = ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(document.RootElement); - return new ContainerServiceManagedClusterResource(_client, data); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceTrustedAccessRoleBindingOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceTrustedAccessRoleBindingOperationSource.cs deleted file mode 100644 index 2750b8b78516..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ContainerServiceTrustedAccessRoleBindingOperationSource.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; - -namespace Azure.ResourceManager.ContainerService -{ - internal class ContainerServiceTrustedAccessRoleBindingOperationSource : IOperationSource - { - private readonly ArmClient _client; - - internal ContainerServiceTrustedAccessRoleBindingOperationSource(ArmClient client) - { - _client = client; - } - - ContainerServiceTrustedAccessRoleBindingResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - var data = ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement); - return new ContainerServiceTrustedAccessRoleBindingResource(_client, data); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - var data = ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement); - return new ContainerServiceTrustedAccessRoleBindingResource(_client, data); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetMemberOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetMemberOperationSource.cs new file mode 100644 index 000000000000..4b59317e4118 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetMemberOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class FleetMemberOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal FleetMemberOperationSource(ArmClient client) + { + _client = client; + } + + FleetMemberResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = FleetMemberData.DeserializeFleetMemberData(document.RootElement); + return new FleetMemberResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = FleetMemberData.DeserializeFleetMemberData(document.RootElement); + return new FleetMemberResource(_client, data); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetOperationSource.cs new file mode 100644 index 000000000000..295d055a57c5 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class FleetOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal FleetOperationSource(ArmClient client) + { + _client = client; + } + + FleetResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = FleetData.DeserializeFleetData(document.RootElement); + return new FleetResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = FleetData.DeserializeFleetData(document.RootElement); + return new FleetResource(_client, data); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetUpdateStrategyOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetUpdateStrategyOperationSource.cs new file mode 100644 index 000000000000..9d6f4373cc7b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/FleetUpdateStrategyOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class FleetUpdateStrategyOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal FleetUpdateStrategyOperationSource(ArmClient client) + { + _client = client; + } + + FleetUpdateStrategyResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(document.RootElement); + return new FleetUpdateStrategyResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(document.RootElement); + return new FleetUpdateStrategyResource(_client, data); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ManagedClusterRunCommandResultOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ManagedClusterRunCommandResultOperationSource.cs deleted file mode 100644 index 803e8e9727db..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/ManagedClusterRunCommandResultOperationSource.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure.Core; -using Azure.ResourceManager.ContainerService.Models; - -namespace Azure.ResourceManager.ContainerService -{ - internal class ManagedClusterRunCommandResultOperationSource : IOperationSource - { - ManagedClusterRunCommandResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) - { - using var document = JsonDocument.Parse(response.ContentStream); - return ManagedClusterRunCommandResult.DeserializeManagedClusterRunCommandResult(document.RootElement); - } - - async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) - { - using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); - return ManagedClusterRunCommandResult.DeserializeManagedClusterRunCommandResult(document.RootElement); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/UpdateRunOperationSource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/UpdateRunOperationSource.cs new file mode 100644 index 000000000000..1b9434c57106 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/LongRunningOperation/UpdateRunOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ContainerService +{ + internal class UpdateRunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal UpdateRunOperationSource(ArmClient client) + { + _client = client; + } + + UpdateRunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = UpdateRunData.DeserializeUpdateRunData(document.RootElement); + return new UpdateRunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = UpdateRunData.DeserializeUpdateRunData(document.RootElement); + return new UpdateRunResource(_client, data); + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.Serialization.cs deleted file mode 100644 index db93b1ecc5bc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.Serialization.cs +++ /dev/null @@ -1,295 +0,0 @@ -// 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 ManagedClusterUpgradeProfileData : 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(ManagedClusterUpgradeProfileData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - writer.WritePropertyName("controlPlaneProfile"u8); - writer.WriteObjectValue(ControlPlaneProfile, options); - writer.WritePropertyName("agentPoolProfiles"u8); - writer.WriteStartArray(); - foreach (var item in AgentPoolProfiles) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - - ManagedClusterUpgradeProfileData 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(ManagedClusterUpgradeProfileData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterUpgradeProfileData(document.RootElement, options); - } - - internal static ManagedClusterUpgradeProfileData DeserializeManagedClusterUpgradeProfileData(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; - ManagedClusterPoolUpgradeProfile controlPlaneProfile = default; - IReadOnlyList agentPoolProfiles = 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("controlPlaneProfile"u8)) - { - controlPlaneProfile = ManagedClusterPoolUpgradeProfile.DeserializeManagedClusterPoolUpgradeProfile(property0.Value, options); - continue; - } - if (property0.NameEquals("agentPoolProfiles"u8)) - { - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(ManagedClusterPoolUpgradeProfile.DeserializeManagedClusterPoolUpgradeProfile(item, options)); - } - agentPoolProfiles = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterUpgradeProfileData( - id, - name, - type, - systemData, - controlPlaneProfile, - agentPoolProfiles, - 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(ControlPlaneProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" controlPlaneProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ControlPlaneProfile)) - { - builder.Append(" controlPlaneProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, ControlPlaneProfile, options, 4, false, " controlPlaneProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentPoolProfiles), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" agentPoolProfiles: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AgentPoolProfiles)) - { - if (AgentPoolProfiles.Any()) - { - builder.Append(" agentPoolProfiles: "); - builder.AppendLine("["); - foreach (var item in AgentPoolProfiles) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " agentPoolProfiles: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(ManagedClusterUpgradeProfileData)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterUpgradeProfileData 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); - return DeserializeManagedClusterUpgradeProfileData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterUpgradeProfileData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs deleted file mode 100644 index 0baa9eb71bbd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileData.cs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; -using Azure.ResourceManager.ContainerService.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A class representing the ManagedClusterUpgradeProfile data model. - /// The list of available upgrades for compute pools. - /// - public partial class ManagedClusterUpgradeProfileData : 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 . - /// The list of available upgrade versions for the control plane. - /// The list of available upgrade versions for agent pools. - /// or is null. - internal ManagedClusterUpgradeProfileData(ManagedClusterPoolUpgradeProfile controlPlaneProfile, IEnumerable agentPoolProfiles) - { - Argument.AssertNotNull(controlPlaneProfile, nameof(controlPlaneProfile)); - Argument.AssertNotNull(agentPoolProfiles, nameof(agentPoolProfiles)); - - ControlPlaneProfile = controlPlaneProfile; - AgentPoolProfiles = agentPoolProfiles.ToList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The list of available upgrade versions for the control plane. - /// The list of available upgrade versions for agent pools. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedClusterPoolUpgradeProfile controlPlaneProfile, IReadOnlyList agentPoolProfiles, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - ControlPlaneProfile = controlPlaneProfile; - AgentPoolProfiles = agentPoolProfiles; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterUpgradeProfileData() - { - } - - /// The list of available upgrade versions for the control plane. - [WirePath("properties.controlPlaneProfile")] - public ManagedClusterPoolUpgradeProfile ControlPlaneProfile { get; } - /// The list of available upgrade versions for agent pools. - [WirePath("properties.agentPoolProfiles")] - public IReadOnlyList AgentPoolProfiles { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.Serialization.cs deleted file mode 100644 index a0579a3fa931..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.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 ManagedClusterUpgradeProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - ManagedClusterUpgradeProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - ManagedClusterUpgradeProfileData 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/ManagedClusterUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs deleted file mode 100644 index ae15f4b29f21..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ManagedClusterUpgradeProfileResource.cs +++ /dev/null @@ -1,170 +0,0 @@ -// 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 ManagedClusterUpgradeProfile 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 GetManagedClusterUpgradeProfileResource method. - /// Otherwise you can get one from its parent resource using the GetManagedClusterUpgradeProfile method. - /// - public partial class ManagedClusterUpgradeProfileResource : 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/managedClusters/{resourceName}/upgradeProfiles/default"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _managedClusterUpgradeProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _managedClusterUpgradeProfileManagedClustersRestClient; - private readonly ManagedClusterUpgradeProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/upgradeProfiles"; - - /// Initializes a new instance of the class for mocking. - protected ManagedClusterUpgradeProfileResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal ManagedClusterUpgradeProfileResource(ArmClient client, ManagedClusterUpgradeProfileData 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 ManagedClusterUpgradeProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _managedClusterUpgradeProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string managedClusterUpgradeProfileManagedClustersApiVersion); - _managedClusterUpgradeProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedClusterUpgradeProfileManagedClustersApiVersion); -#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 ManagedClusterUpgradeProfileData 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 upgrade profile of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default - /// - /// - /// Operation Id - /// ManagedClusters_GetUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _managedClusterUpgradeProfileManagedClustersClientDiagnostics.CreateScope("ManagedClusterUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = await _managedClusterUpgradeProfileManagedClustersRestClient.GetUpgradeProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ManagedClusterUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets the upgrade profile of a managed cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/upgradeProfiles/default - /// - /// - /// Operation Id - /// ManagedClusters_GetUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _managedClusterUpgradeProfileManagedClustersClientDiagnostics.CreateScope("ManagedClusterUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = _managedClusterUpgradeProfileManagedClustersRestClient.GetUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new ManagedClusterUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs deleted file mode 100644 index 73f52e619891..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileCollection.cs +++ /dev/null @@ -1,399 +0,0 @@ -// 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 GetMeshRevisionProfiles method from an instance of . - /// - public partial class MeshRevisionProfileCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _meshRevisionProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _meshRevisionProfileManagedClustersRestClient; - private readonly AzureLocation _location; - - /// Initializes a new instance of the class for mocking. - protected MeshRevisionProfileCollection() - { - } - - /// 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 MeshRevisionProfileCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) - { - _location = location; - _meshRevisionProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", MeshRevisionProfileResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(MeshRevisionProfileResource.ResourceType, out string meshRevisionProfileManagedClustersApiVersion); - _meshRevisionProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, meshRevisionProfileManagedClustersApiVersion); -#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 extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.Get"); - scope.Start(); - try - { - var response = await _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfileAsync(Id.SubscriptionId, new AzureLocation(_location), mode, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshRevisionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.Get"); - scope.Start(); - try - { - var response = _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfile(Id.SubscriptionId, new AzureLocation(_location), mode, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshRevisionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles - /// - /// - /// Operation Id - /// ManagedClusters_ListMeshRevisionProfiles - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _meshRevisionProfileManagedClustersRestClient.CreateListMeshRevisionProfilesRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _meshRevisionProfileManagedClustersRestClient.CreateListMeshRevisionProfilesNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MeshRevisionProfileResource(Client, MeshRevisionProfileData.DeserializeMeshRevisionProfileData(e)), _meshRevisionProfileManagedClustersClientDiagnostics, Pipeline, "MeshRevisionProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Contains extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles - /// - /// - /// Operation Id - /// ManagedClusters_ListMeshRevisionProfiles - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _meshRevisionProfileManagedClustersRestClient.CreateListMeshRevisionProfilesRequest(Id.SubscriptionId, new AzureLocation(_location)); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _meshRevisionProfileManagedClustersRestClient.CreateListMeshRevisionProfilesNextPageRequest(nextLink, Id.SubscriptionId, new AzureLocation(_location)); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MeshRevisionProfileResource(Client, MeshRevisionProfileData.DeserializeMeshRevisionProfileData(e)), _meshRevisionProfileManagedClustersClientDiagnostics, Pipeline, "MeshRevisionProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.Exists"); - scope.Start(); - try - { - var response = await _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfileAsync(Id.SubscriptionId, new AzureLocation(_location), mode, 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}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.Exists"); - scope.Start(); - try - { - var response = _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfile(Id.SubscriptionId, new AzureLocation(_location), mode, 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}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfileAsync(Id.SubscriptionId, new AzureLocation(_location), mode, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new MeshRevisionProfileResource(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}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfile(Id.SubscriptionId, new AzureLocation(_location), mode, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new MeshRevisionProfileResource(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/MeshRevisionProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.Serialization.cs deleted file mode 100644 index 4232728b80f5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.Serialization.cs +++ /dev/null @@ -1,244 +0,0 @@ -// 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 MeshRevisionProfileData : 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(MeshRevisionProfileData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - } - } - - MeshRevisionProfileData 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(MeshRevisionProfileData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshRevisionProfileData(document.RootElement, options); - } - - internal static MeshRevisionProfileData DeserializeMeshRevisionProfileData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MeshRevisionProfileProperties 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)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = MeshRevisionProfileProperties.DeserializeMeshRevisionProfileProperties(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 MeshRevisionProfileData( - 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("MeshRevisions", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" properties: "); - builder.AppendLine("{"); - builder.Append(" meshRevisions: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - 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(MeshRevisionProfileData)} does not support writing '{options.Format}' format."); - } - } - - MeshRevisionProfileData 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); - return DeserializeMeshRevisionProfileData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MeshRevisionProfileData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.cs deleted file mode 100644 index 34a134c5fc1f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileData.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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 MeshRevisionProfile data model. - /// Mesh revision profile for a mesh. - /// - public partial class MeshRevisionProfileData : 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 MeshRevisionProfileData() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Mesh revision profile properties for a mesh. - /// Keeps track of any properties unknown to the library. - internal MeshRevisionProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MeshRevisionProfileProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Mesh revision profile properties for a mesh. - internal MeshRevisionProfileProperties Properties { get; set; } - /// Gets the mesh revisions. - [WirePath("properties.meshRevisions")] - public IList MeshRevisions - { - get - { - if (Properties is null) - Properties = new MeshRevisionProfileProperties(); - return Properties.MeshRevisions; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.Serialization.cs deleted file mode 100644 index a4372b8ff206..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.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 MeshRevisionProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - MeshRevisionProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - MeshRevisionProfileData 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/MeshRevisionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs deleted file mode 100644 index 349a3898fb10..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshRevisionProfileResource.cs +++ /dev/null @@ -1,171 +0,0 @@ -// 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 MeshRevisionProfile 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 GetMeshRevisionProfileResource method. - /// Otherwise you can get one from its parent resource using the GetMeshRevisionProfile method. - /// - public partial class MeshRevisionProfileResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The location. - /// The mode. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location, string mode) - { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _meshRevisionProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _meshRevisionProfileManagedClustersRestClient; - private readonly MeshRevisionProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/meshRevisionProfiles"; - - /// Initializes a new instance of the class for mocking. - protected MeshRevisionProfileResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal MeshRevisionProfileResource(ArmClient client, MeshRevisionProfileData 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 MeshRevisionProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _meshRevisionProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string meshRevisionProfileManagedClustersApiVersion); - _meshRevisionProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, meshRevisionProfileManagedClustersApiVersion); -#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 MeshRevisionProfileData 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 extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileResource.Get"); - scope.Start(); - try - { - var response = await _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfileAsync(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 MeshRevisionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Contains extra metadata on the revision, including supported revisions, cluster compatibility and available upgrades - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/meshRevisionProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshRevisionProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _meshRevisionProfileManagedClustersClientDiagnostics.CreateScope("MeshRevisionProfileResource.Get"); - scope.Start(); - try - { - var response = _meshRevisionProfileManagedClustersRestClient.GetMeshRevisionProfile(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshRevisionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs deleted file mode 100644 index c9c2c819a366..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileCollection.cs +++ /dev/null @@ -1,395 +0,0 @@ -// 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 GetMeshUpgradeProfiles method from an instance of . - /// - public partial class MeshUpgradeProfileCollection : ArmCollection, IEnumerable, IAsyncEnumerable - { - private readonly ClientDiagnostics _meshUpgradeProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _meshUpgradeProfileManagedClustersRestClient; - - /// Initializes a new instance of the class for mocking. - protected MeshUpgradeProfileCollection() - { - } - - /// 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 MeshUpgradeProfileCollection(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _meshUpgradeProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", MeshUpgradeProfileResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(MeshUpgradeProfileResource.ResourceType, out string meshUpgradeProfileManagedClustersApiVersion); - _meshUpgradeProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, meshUpgradeProfileManagedClustersApiVersion); -#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)); - } - - /// - /// Gets available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.Get"); - scope.Start(); - try - { - var response = await _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Get(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.Get"); - scope.Start(); - try - { - var response = _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Lists available upgrades for all service meshes in a specific cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles - /// - /// - /// Operation Id - /// ManagedClusters_ListMeshUpgradeProfiles - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _meshUpgradeProfileManagedClustersRestClient.CreateListMeshUpgradeProfilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _meshUpgradeProfileManagedClustersRestClient.CreateListMeshUpgradeProfilesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MeshUpgradeProfileResource(Client, MeshUpgradeProfileData.DeserializeMeshUpgradeProfileData(e)), _meshUpgradeProfileManagedClustersClientDiagnostics, Pipeline, "MeshUpgradeProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Lists available upgrades for all service meshes in a specific cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles - /// - /// - /// Operation Id - /// ManagedClusters_ListMeshUpgradeProfiles - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) => _meshUpgradeProfileManagedClustersRestClient.CreateListMeshUpgradeProfilesRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _meshUpgradeProfileManagedClustersRestClient.CreateListMeshUpgradeProfilesNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MeshUpgradeProfileResource(Client, MeshUpgradeProfileData.DeserializeMeshUpgradeProfileData(e)), _meshUpgradeProfileManagedClustersClientDiagnostics, Pipeline, "MeshUpgradeProfileCollection.GetAll", "value", "nextLink", cancellationToken); - } - - /// - /// Checks to see if the resource exists in azure. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> ExistsAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.Exists"); - scope.Start(); - try - { - var response = await _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, 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}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual Response Exists(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.Exists"); - scope.Start(); - try - { - var response = _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, 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}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual async Task> GetIfExistsAsync(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = await _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfileAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, cancellationToken: cancellationToken).ConfigureAwait(false); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new MeshUpgradeProfileResource(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}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The mode of the mesh. - /// The cancellation token to use. - /// is an empty string, and was expected to be non-empty. - /// is null. - public virtual NullableResponse GetIfExists(string mode, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(mode, nameof(mode)); - - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileCollection.GetIfExists"); - scope.Start(); - try - { - var response = _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, mode, cancellationToken: cancellationToken); - if (response.Value == null) - return new NoValueResponse(response.GetRawResponse()); - return Response.FromValue(new MeshUpgradeProfileResource(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/MeshUpgradeProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.Serialization.cs deleted file mode 100644 index 1750f594f6d5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.Serialization.cs +++ /dev/null @@ -1,241 +0,0 @@ -// 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 MeshUpgradeProfileData : 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(MeshUpgradeProfileData)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - if (Optional.IsDefined(Properties)) - { - writer.WritePropertyName("properties"u8); - writer.WriteObjectValue(Properties, options); - } - } - - MeshUpgradeProfileData 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(MeshUpgradeProfileData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshUpgradeProfileData(document.RootElement, options); - } - - internal static MeshUpgradeProfileData DeserializeMeshUpgradeProfileData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - MeshUpgradeProfileProperties 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)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - properties = MeshUpgradeProfileProperties.DeserializeMeshUpgradeProfileProperties(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 MeshUpgradeProfileData( - 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(MeshUpgradeProfileData)} does not support writing '{options.Format}' format."); - } - } - - MeshUpgradeProfileData 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); - return DeserializeMeshUpgradeProfileData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MeshUpgradeProfileData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.cs deleted file mode 100644 index fc06ca5a833a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileData.cs +++ /dev/null @@ -1,76 +0,0 @@ -// 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 MeshUpgradeProfile data model. - /// Upgrade profile for given mesh. - /// - public partial class MeshUpgradeProfileData : 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 MeshUpgradeProfileData() - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Mesh upgrade profile properties for a major.minor release. - /// Keeps track of any properties unknown to the library. - internal MeshUpgradeProfileData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, MeshUpgradeProfileProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) - { - Properties = properties; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Mesh upgrade profile properties for a major.minor release. - [WirePath("properties")] - public MeshUpgradeProfileProperties Properties { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.Serialization.cs deleted file mode 100644 index 5bb3ba35e73b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.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 MeshUpgradeProfileResource : IJsonModel - { - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); - - MeshUpgradeProfileData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); - - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); - - MeshUpgradeProfileData 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/MeshUpgradeProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs deleted file mode 100644 index 84cce4083213..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/MeshUpgradeProfileResource.cs +++ /dev/null @@ -1,171 +0,0 @@ -// 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 MeshUpgradeProfile 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 GetMeshUpgradeProfileResource method. - /// Otherwise you can get one from its parent resource using the GetMeshUpgradeProfile method. - /// - public partial class MeshUpgradeProfileResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The resourceGroupName. - /// The resourceName. - /// The mode. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string resourceName, string mode) - { - var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode}"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _meshUpgradeProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _meshUpgradeProfileManagedClustersRestClient; - private readonly MeshUpgradeProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/managedClusters/meshUpgradeProfiles"; - - /// Initializes a new instance of the class for mocking. - protected MeshUpgradeProfileResource() - { - } - - /// Initializes a new instance of the class. - /// The client parameters to use in these operations. - /// The resource that is the target of operations. - internal MeshUpgradeProfileResource(ArmClient client, MeshUpgradeProfileData 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 MeshUpgradeProfileResource(ArmClient client, ResourceIdentifier id) : base(client, id) - { - _meshUpgradeProfileManagedClustersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string meshUpgradeProfileManagedClustersApiVersion); - _meshUpgradeProfileManagedClustersRestClient = new ManagedClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, meshUpgradeProfileManagedClustersApiVersion); -#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 MeshUpgradeProfileData 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 available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual async Task> GetAsync(CancellationToken cancellationToken = default) - { - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = await _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfileAsync(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 MeshUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets available upgrades for a service mesh in a cluster. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/managedClusters/{resourceName}/meshUpgradeProfiles/{mode} - /// - /// - /// Operation Id - /// ManagedClusters_GetMeshUpgradeProfile - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// Resource - /// - /// - /// - /// - /// The cancellation token to use. - public virtual Response Get(CancellationToken cancellationToken = default) - { - using var scope = _meshUpgradeProfileManagedClustersClientDiagnostics.CreateScope("MeshUpgradeProfileResource.Get"); - scope.Start(); - try - { - var response = _meshUpgradeProfileManagedClustersRestClient.GetMeshUpgradeProfile(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new MeshUpgradeProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs deleted file mode 100644 index 1a08159183f6..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.cs +++ /dev/null @@ -1,76 +0,0 @@ -// 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 AgentPoolAvailableVersion. - public partial class AgentPoolAvailableVersion - { - /// - /// 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 AgentPoolAvailableVersion() - { - } - - /// Initializes a new instance of . - /// Whether this version is the default agent pool version. - /// The Kubernetes version (major.minor.patch). - /// Whether Kubernetes version is currently in preview. - /// Keeps track of any properties unknown to the library. - internal AgentPoolAvailableVersion(bool? isDefault, string kubernetesVersion, bool? isPreview, IDictionary serializedAdditionalRawData) - { - IsDefault = isDefault; - KubernetesVersion = kubernetesVersion; - IsPreview = isPreview; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether this version is the default agent pool version. - [WirePath("default")] - public bool? IsDefault { get; } - /// The Kubernetes version (major.minor.patch). - [WirePath("kubernetesVersion")] - public string KubernetesVersion { get; } - /// Whether Kubernetes version is currently in preview. - [WirePath("isPreview")] - public bool? IsPreview { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs deleted file mode 100644 index 98e5614caafa..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.Serialization.cs +++ /dev/null @@ -1,277 +0,0 @@ -// 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.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - public partial class AgentPoolAvailableVersions : 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(AgentPoolAvailableVersions)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(AgentPoolVersions)) - { - writer.WritePropertyName("agentPoolVersions"u8); - writer.WriteStartArray(); - foreach (var item in AgentPoolVersions) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - writer.WriteEndObject(); - } - - AgentPoolAvailableVersions 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(AgentPoolAvailableVersions)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolAvailableVersions(document.RootElement, options); - } - - internal static AgentPoolAvailableVersions DeserializeAgentPoolAvailableVersions(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; - IReadOnlyList agentPoolVersions = 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("agentPoolVersions"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) - { - array.Add(AgentPoolAvailableVersion.DeserializeAgentPoolAvailableVersion(item, options)); - } - agentPoolVersions = array; - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolAvailableVersions( - id, - name, - type, - systemData, - agentPoolVersions ?? 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(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(AgentPoolVersions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" agentPoolVersions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AgentPoolVersions)) - { - if (AgentPoolVersions.Any()) - { - builder.Append(" agentPoolVersions: "); - builder.AppendLine("["); - foreach (var item in AgentPoolVersions) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " agentPoolVersions: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(AgentPoolAvailableVersions)} does not support writing '{options.Format}' format."); - } - } - - AgentPoolAvailableVersions 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); - return DeserializeAgentPoolAvailableVersions(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AgentPoolAvailableVersions)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs deleted file mode 100644 index 25d01165d700..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// 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. - public readonly partial struct AgentPoolMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AgentPoolMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SystemValue = "System"; - private const string UserValue = "User"; - - /// 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); - /// 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. - public static bool operator !=(AgentPoolMode left, AgentPoolMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AgentPoolMode(string value) => new AgentPoolMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AgentPoolMode other && Equals(other); - /// - public bool Equals(AgentPoolMode 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/AgentPoolNetworkPortProtocol.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortProtocol.cs deleted file mode 100644 index bf37220a3821..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortProtocol.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 network protocol of the port. - public readonly partial struct AgentPoolNetworkPortProtocol : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AgentPoolNetworkPortProtocol(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TcpValue = "TCP"; - private const string UdpValue = "UDP"; - - /// TCP protocol. - public static AgentPoolNetworkPortProtocol Tcp { get; } = new AgentPoolNetworkPortProtocol(TcpValue); - /// UDP protocol. - public static AgentPoolNetworkPortProtocol Udp { get; } = new AgentPoolNetworkPortProtocol(UdpValue); - /// Determines if two values are the same. - public static bool operator ==(AgentPoolNetworkPortProtocol left, AgentPoolNetworkPortProtocol right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AgentPoolNetworkPortProtocol left, AgentPoolNetworkPortProtocol right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AgentPoolNetworkPortProtocol(string value) => new AgentPoolNetworkPortProtocol(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AgentPoolNetworkPortProtocol other && Equals(other); - /// - public bool Equals(AgentPoolNetworkPortProtocol 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/AgentPoolNetworkPortRange.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs deleted file mode 100644 index 0761f7097c85..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.Serialization.cs +++ /dev/null @@ -1,226 +0,0 @@ -// 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 AgentPoolNetworkPortRange : 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(AgentPoolNetworkPortRange)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(PortStart)) - { - writer.WritePropertyName("portStart"u8); - writer.WriteNumberValue(PortStart.Value); - } - if (Optional.IsDefined(PortEnd)) - { - writer.WritePropertyName("portEnd"u8); - writer.WriteNumberValue(PortEnd.Value); - } - if (Optional.IsDefined(Protocol)) - { - writer.WritePropertyName("protocol"u8); - writer.WriteStringValue(Protocol.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AgentPoolNetworkPortRange 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(AgentPoolNetworkPortRange)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolNetworkPortRange(document.RootElement, options); - } - - internal static AgentPoolNetworkPortRange DeserializeAgentPoolNetworkPortRange(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? portStart = default; - int? portEnd = default; - AgentPoolNetworkPortProtocol? protocol = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("portStart"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - portStart = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("portEnd"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - portEnd = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("protocol"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - protocol = new AgentPoolNetworkPortProtocol(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolNetworkPortRange(portStart, portEnd, protocol, 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(PortStart), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" portStart: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PortStart)) - { - builder.Append(" portStart: "); - builder.AppendLine($"{PortStart.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PortEnd), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" portEnd: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PortEnd)) - { - builder.Append(" portEnd: "); - builder.AppendLine($"{PortEnd.Value}"); - } - } - - 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()}'"); - } - } - - 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(AgentPoolNetworkPortRange)} does not support writing '{options.Format}' format."); - } - } - - AgentPoolNetworkPortRange 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); - return DeserializeAgentPoolNetworkPortRange(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AgentPoolNetworkPortRange)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs deleted file mode 100644 index ba7aa7337fa3..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkPortRange.cs +++ /dev/null @@ -1,76 +0,0 @@ -// 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 port range. - public partial class AgentPoolNetworkPortRange - { - /// - /// 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 AgentPoolNetworkPortRange() - { - } - - /// Initializes a new instance of . - /// The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. - /// The maximum port that is included in the range. It should be ranged from 1 to 65535, and be greater than or equal to portStart. - /// The network protocol of the port. - /// Keeps track of any properties unknown to the library. - internal AgentPoolNetworkPortRange(int? portStart, int? portEnd, AgentPoolNetworkPortProtocol? protocol, IDictionary serializedAdditionalRawData) - { - PortStart = portStart; - PortEnd = portEnd; - Protocol = protocol; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The minimum port that is included in the range. It should be ranged from 1 to 65535, and be less than or equal to portEnd. - [WirePath("portStart")] - public int? PortStart { get; set; } - /// The maximum port that is included in the range. It should be ranged from 1 to 65535, and be greater than or equal to portStart. - [WirePath("portEnd")] - public int? PortEnd { get; set; } - /// The network protocol of the port. - [WirePath("protocol")] - public AgentPoolNetworkPortProtocol? Protocol { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs deleted file mode 100644 index ad0468f383c4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.Serialization.cs +++ /dev/null @@ -1,298 +0,0 @@ -// 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 AgentPoolNetworkProfile : 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(AgentPoolNetworkProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(NodePublicIPTags)) - { - writer.WritePropertyName("nodePublicIPTags"u8); - writer.WriteStartArray(); - foreach (var item in NodePublicIPTags) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(AllowedHostPorts)) - { - writer.WritePropertyName("allowedHostPorts"u8); - writer.WriteStartArray(); - foreach (var item in AllowedHostPorts) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(ApplicationSecurityGroups)) - { - writer.WritePropertyName("applicationSecurityGroups"u8); - writer.WriteStartArray(); - foreach (var item in ApplicationSecurityGroups) - { - if (item == null) - { - writer.WriteNullValue(); - continue; - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AgentPoolNetworkProfile 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(AgentPoolNetworkProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolNetworkProfile(document.RootElement, options); - } - - internal static AgentPoolNetworkProfile DeserializeAgentPoolNetworkProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList nodePublicIPTags = default; - IList allowedHostPorts = default; - IList applicationSecurityGroups = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("nodePublicIPTags"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ContainerServiceIPTag.DeserializeContainerServiceIPTag(item, options)); - } - nodePublicIPTags = array; - continue; - } - if (property.NameEquals("allowedHostPorts"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(AgentPoolNetworkPortRange.DeserializeAgentPoolNetworkPortRange(item, options)); - } - allowedHostPorts = array; - continue; - } - if (property.NameEquals("applicationSecurityGroups"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())); - } - } - applicationSecurityGroups = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolNetworkProfile(nodePublicIPTags ?? new ChangeTrackingList(), allowedHostPorts ?? new ChangeTrackingList(), applicationSecurityGroups ?? 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(NodePublicIPTags), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodePublicIPTags: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodePublicIPTags)) - { - if (NodePublicIPTags.Any()) - { - builder.Append(" nodePublicIPTags: "); - builder.AppendLine("["); - foreach (var item in NodePublicIPTags) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " nodePublicIPTags: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowedHostPorts), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" allowedHostPorts: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AllowedHostPorts)) - { - if (AllowedHostPorts.Any()) - { - builder.Append(" allowedHostPorts: "); - builder.AppendLine("["); - foreach (var item in AllowedHostPorts) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " allowedHostPorts: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApplicationSecurityGroups), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" applicationSecurityGroups: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ApplicationSecurityGroups)) - { - if (ApplicationSecurityGroups.Any()) - { - builder.Append(" applicationSecurityGroups: "); - builder.AppendLine("["); - foreach (var item in ApplicationSecurityGroups) - { - if (item == null) - { - builder.Append("null"); - continue; - } - builder.AppendLine($" '{item.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(AgentPoolNetworkProfile)} does not support writing '{options.Format}' format."); - } - } - - AgentPoolNetworkProfile 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); - return DeserializeAgentPoolNetworkProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AgentPoolNetworkProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs deleted file mode 100644 index e99493f184ec..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolNetworkProfile.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// Network settings of an agent pool. - public partial class AgentPoolNetworkProfile - { - /// - /// 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 AgentPoolNetworkProfile() - { - NodePublicIPTags = new ChangeTrackingList(); - AllowedHostPorts = new ChangeTrackingList(); - ApplicationSecurityGroups = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// IPTags of instance-level public IPs. - /// The port ranges that are allowed to access. The specified ranges are allowed to overlap. - /// The IDs of the application security groups which agent pool will associate when created. - /// Keeps track of any properties unknown to the library. - internal AgentPoolNetworkProfile(IList nodePublicIPTags, IList allowedHostPorts, IList applicationSecurityGroups, IDictionary serializedAdditionalRawData) - { - NodePublicIPTags = nodePublicIPTags; - AllowedHostPorts = allowedHostPorts; - ApplicationSecurityGroups = applicationSecurityGroups; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// IPTags of instance-level public IPs. - [WirePath("nodePublicIPTags")] - public IList NodePublicIPTags { get; } - /// The port ranges that are allowed to access. The specified ranges are allowed to overlap. - [WirePath("allowedHostPorts")] - public IList AllowedHostPorts { get; } - /// The IDs of the application security groups which agent pool will associate when created. - [WirePath("applicationSecurityGroups")] - public IList ApplicationSecurityGroups { 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 deleted file mode 100644 index 90e83bff8f49..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 type of Agent Pool. - public readonly partial struct AgentPoolType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AgentPoolType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string VirtualMachineScaleSetsValue = "VirtualMachineScaleSets"; - private const string AvailabilitySetValue = "AvailabilitySet"; - - /// 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); - /// 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. - public static bool operator !=(AgentPoolType left, AgentPoolType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AgentPoolType(string value) => new AgentPoolType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AgentPoolType other && Equals(other); - /// - public bool Equals(AgentPoolType 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/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs deleted file mode 100644 index 2c249418ee96..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.Serialization.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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 AgentPoolUpgradeProfilePropertiesUpgradesItem : 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(AgentPoolUpgradeProfilePropertiesUpgradesItem)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(KubernetesVersion)) - { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - } - if (Optional.IsDefined(IsPreview)) - { - writer.WritePropertyName("isPreview"u8); - writer.WriteBooleanValue(IsPreview.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - AgentPoolUpgradeProfilePropertiesUpgradesItem 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(AgentPoolUpgradeProfilePropertiesUpgradesItem)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(document.RootElement, options); - } - - internal static AgentPoolUpgradeProfilePropertiesUpgradesItem DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string kubernetesVersion = default; - bool? isPreview = 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("isPreview"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isPreview = 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); - } - - 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(IsPreview), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isPreview: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsPreview)) - { - builder.Append(" isPreview: "); - var boolValue = IsPreview.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(AgentPoolUpgradeProfilePropertiesUpgradesItem)} does not support writing '{options.Format}' format."); - } - } - - AgentPoolUpgradeProfilePropertiesUpgradesItem 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); - return DeserializeAgentPoolUpgradeProfilePropertiesUpgradesItem(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(AgentPoolUpgradeProfilePropertiesUpgradesItem)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs deleted file mode 100644 index a57cb99ed6af..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 -{ - /// Settings for upgrading an agentpool. - public partial class AgentPoolUpgradeSettings - { - /// - /// 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 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. - /// 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. - /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeSettings(string maxSurge, int? drainTimeoutInMinutes, IDictionary serializedAdditionalRawData) - { - MaxSurge = maxSurge; - DrainTimeoutInMinutes = drainTimeoutInMinutes; - _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. - [WirePath("maxSurge")] - public string MaxSurge { 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; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.Serialization.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.Serialization.cs index aec1ab565325..321acec05fdf 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeSettings.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolUpgradeSettings : IUtf8JsonSerializable, IJsonModel + public partial class AgentProfile : 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,21 +29,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(AgentPoolUpgradeSettings)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AgentProfile)} does not support writing '{format}' format."); } - if (Optional.IsDefined(MaxSurge)) + if (Optional.IsDefined(SubnetId)) { - writer.WritePropertyName("maxSurge"u8); - writer.WriteStringValue(MaxSurge); + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); } - if (Optional.IsDefined(DrainTimeoutInMinutes)) + if (Optional.IsDefined(VmSize)) { - writer.WritePropertyName("drainTimeoutInMinutes"u8); - writer.WriteNumberValue(DrainTimeoutInMinutes.Value); + writer.WritePropertyName("vmSize"u8); + writer.WriteStringValue(VmSize); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AgentPoolUpgradeSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AgentProfile 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(AgentPoolUpgradeSettings)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AgentProfile)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolUpgradeSettings(document.RootElement, options); + return DeserializeAgentProfile(document.RootElement, options); } - internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(JsonElement element, ModelReaderWriterOptions options = null) + internal static AgentProfile DeserializeAgentProfile(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -82,24 +82,24 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso { return null; } - string maxSurge = default; - int? drainTimeoutInMinutes = default; + ResourceIdentifier subnetId = default; + string vmSize = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("maxSurge"u8)) - { - maxSurge = property.Value.GetString(); - continue; - } - if (property.NameEquals("drainTimeoutInMinutes"u8)) + if (property.NameEquals("subnetId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - drainTimeoutInMinutes = property.Value.GetInt32(); + subnetId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("vmSize"u8)) + { + vmSize = property.Value.GetString(); continue; } if (options.Format != "W") @@ -108,7 +108,7 @@ internal static AgentPoolUpgradeSettings DeserializeAgentPoolUpgradeSettings(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolUpgradeSettings(maxSurge, drainTimeoutInMinutes, serializedAdditionalRawData); + return new AgentProfile(subnetId, vmSize, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -122,41 +122,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxSurge), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubnetId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" maxSurge: "); + builder.Append(" subnetId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(MaxSurge)) + if (Optional.IsDefined(SubnetId)) { - builder.Append(" maxSurge: "); - if (MaxSurge.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxSurge}'''"); - } - else - { - builder.AppendLine($"'{MaxSurge}'"); - } + builder.Append(" subnetId: "); + builder.AppendLine($"'{SubnetId.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DrainTimeoutInMinutes), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSize), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" drainTimeoutInMinutes: "); + builder.Append(" vmSize: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(DrainTimeoutInMinutes)) + if (Optional.IsDefined(VmSize)) { - builder.Append(" drainTimeoutInMinutes: "); - builder.AppendLine($"{DrainTimeoutInMinutes.Value}"); + builder.Append(" vmSize: "); + if (VmSize.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmSize}'''"); + } + else + { + builder.AppendLine($"'{VmSize}'"); + } } } @@ -164,9 +164,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -175,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(AgentPoolUpgradeSettings)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AgentProfile)} does not support writing '{options.Format}' format."); } } - AgentPoolUpgradeSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AgentProfile 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); - return DeserializeAgentPoolUpgradeSettings(document.RootElement, options); + return DeserializeAgentProfile(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AgentPoolUpgradeSettings)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AgentProfile)} 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/AgentPoolSnapshotListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.cs index ba4bc7caa1fc..b091571075be 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentProfile.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models { - /// The response from the List Snapshots operation. - internal partial class AgentPoolSnapshotListResult + /// Agent profile for the Fleet hub. + public partial class AgentProfile { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,27 @@ internal partial class AgentPoolSnapshotListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AgentPoolSnapshotListResult() + /// Initializes a new instance of . + public AgentProfile() { - Value = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The list of snapshots. - /// The URL to get the next set of snapshot results. + /// Initializes a new instance of . + /// The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. + /// The virtual machine size of the Fleet hub. /// Keeps track of any properties unknown to the library. - internal AgentPoolSnapshotListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal AgentProfile(ResourceIdentifier subnetId, string vmSize, IDictionary serializedAdditionalRawData) { - Value = value; - NextLink = nextLink; + SubnetId = subnetId; + VmSize = vmSize; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The list of snapshots. - public IReadOnlyList Value { get; } - /// The URL to get the next set of snapshot results. - public string NextLink { get; } + /// The ID of the subnet which the Fleet hub node will join on startup. If this is not specified, a vnet and subnet will be generated and used. + [WirePath("subnetId")] + public ResourceIdentifier SubnetId { get; set; } + /// The virtual machine size of the Fleet hub. + [WirePath("vmSize")] + public string VmSize { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.Serialization.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.Serialization.cs index 0cd58983d378..6901cc73a6a5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersion.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class AgentPoolAvailableVersion : IUtf8JsonSerializable, IJsonModel + public partial class ApiServerAccessProfile : 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,26 +29,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(AgentPoolAvailableVersion)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ApiServerAccessProfile)} does not support writing '{format}' format."); } - if (Optional.IsDefined(IsDefault)) + if (Optional.IsDefined(EnablePrivateCluster)) { - writer.WritePropertyName("default"u8); - writer.WriteBooleanValue(IsDefault.Value); + writer.WritePropertyName("enablePrivateCluster"u8); + writer.WriteBooleanValue(EnablePrivateCluster.Value); } - if (Optional.IsDefined(KubernetesVersion)) + if (Optional.IsDefined(EnableVnetIntegration)) { - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); + writer.WritePropertyName("enableVnetIntegration"u8); + writer.WriteBooleanValue(EnableVnetIntegration.Value); } - if (Optional.IsDefined(IsPreview)) + if (Optional.IsDefined(SubnetId)) { - writer.WritePropertyName("isPreview"u8); - writer.WriteBooleanValue(IsPreview.Value); + writer.WritePropertyName("subnetId"u8); + writer.WriteStringValue(SubnetId); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -67,19 +67,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AgentPoolAvailableVersion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ApiServerAccessProfile 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(AgentPoolAvailableVersion)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ApiServerAccessProfile)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolAvailableVersion(document.RootElement, options); + return DeserializeApiServerAccessProfile(document.RootElement, options); } - internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(JsonElement element, ModelReaderWriterOptions options = null) + internal static ApiServerAccessProfile DeserializeApiServerAccessProfile(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,34 +87,38 @@ internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(J { return null; } - bool? @default = default; - string kubernetesVersion = default; - bool? isPreview = default; + bool? enablePrivateCluster = default; + bool? enableVnetIntegration = default; + ResourceIdentifier subnetId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("default"u8)) + if (property.NameEquals("enablePrivateCluster"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - @default = property.Value.GetBoolean(); + enablePrivateCluster = property.Value.GetBoolean(); continue; } - if (property.NameEquals("kubernetesVersion"u8)) + if (property.NameEquals("enableVnetIntegration"u8)) { - kubernetesVersion = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableVnetIntegration = property.Value.GetBoolean(); continue; } - if (property.NameEquals("isPreview"u8)) + if (property.NameEquals("subnetId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - isPreview = property.Value.GetBoolean(); + subnetId = new ResourceIdentifier(property.Value.GetString()); continue; } if (options.Format != "W") @@ -123,7 +127,7 @@ internal static AgentPoolAvailableVersion DeserializeAgentPoolAvailableVersion(J } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolAvailableVersion(@default, kubernetesVersion, isPreview, serializedAdditionalRawData); + return new ApiServerAccessProfile(enablePrivateCluster, enableVnetIntegration, subnetId, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -137,58 +141,50 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsDefault), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePrivateCluster), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" default: "); + builder.Append(" enablePrivateCluster: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IsDefault)) + if (Optional.IsDefined(EnablePrivateCluster)) { - builder.Append(" default: "); - var boolValue = IsDefault.Value == true ? "true" : "false"; + builder.Append(" enablePrivateCluster: "); + var boolValue = EnablePrivateCluster.Value == true ? "true" : "false"; builder.AppendLine($"{boolValue}"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableVnetIntegration), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" kubernetesVersion: "); + builder.Append(" enableVnetIntegration: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(KubernetesVersion)) + if (Optional.IsDefined(EnableVnetIntegration)) { - builder.Append(" kubernetesVersion: "); - if (KubernetesVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{KubernetesVersion}'''"); - } - else - { - builder.AppendLine($"'{KubernetesVersion}'"); - } + builder.Append(" enableVnetIntegration: "); + var boolValue = EnableVnetIntegration.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPreview), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SubnetId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" isPreview: "); + builder.Append(" subnetId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IsPreview)) + if (Optional.IsDefined(SubnetId)) { - builder.Append(" isPreview: "); - var boolValue = IsPreview.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" subnetId: "); + builder.AppendLine($"'{SubnetId.ToString()}'"); } } @@ -196,9 +192,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -207,26 +203,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(AgentPoolAvailableVersion)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ApiServerAccessProfile)} does not support writing '{options.Format}' format."); } } - AgentPoolAvailableVersion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ApiServerAccessProfile 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); - return DeserializeAgentPoolAvailableVersion(document.RootElement, options); + return DeserializeApiServerAccessProfile(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AgentPoolAvailableVersion)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ApiServerAccessProfile)} 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/AgentPoolAvailableVersions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.cs similarity index 55% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.cs index 512c1d7e0a3e..a94e5db7805f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolAvailableVersions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ApiServerAccessProfile.cs @@ -8,12 +8,11 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService.Models { - /// The list of available versions for an agent pool. - public partial class AgentPoolAvailableVersions : ResourceData + /// Access profile for the Fleet hub API server. + public partial class ApiServerAccessProfile { /// /// Keeps track of any properties unknown to the library. @@ -47,27 +46,32 @@ public partial class AgentPoolAvailableVersions : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AgentPoolAvailableVersions() + /// Initializes a new instance of . + public ApiServerAccessProfile() { - AgentPoolVersions = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// List of versions available for agent pool. + /// Initializes a new instance of . + /// Whether to create the Fleet hub as a private cluster or not. + /// Whether to enable apiserver vnet integration for the Fleet hub or not. + /// The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. /// Keeps track of any properties unknown to the library. - internal AgentPoolAvailableVersions(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList agentPoolVersions, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ApiServerAccessProfile(bool? enablePrivateCluster, bool? enableVnetIntegration, ResourceIdentifier subnetId, IDictionary serializedAdditionalRawData) { - AgentPoolVersions = agentPoolVersions; + EnablePrivateCluster = enablePrivateCluster; + EnableVnetIntegration = enableVnetIntegration; + SubnetId = subnetId; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// List of versions available for agent pool. - [WirePath("properties.agentPoolVersions")] - public IReadOnlyList AgentPoolVersions { get; } + /// Whether to create the Fleet hub as a private cluster or not. + [WirePath("enablePrivateCluster")] + public bool? EnablePrivateCluster { get; set; } + /// Whether to enable apiserver vnet integration for the Fleet hub or not. + [WirePath("enableVnetIntegration")] + public bool? EnableVnetIntegration { get; set; } + /// The subnet to be used when apiserver vnet integration is enabled. It is required when creating a new Fleet with BYO vnet. + [WirePath("subnetId")] + public ResourceIdentifier SubnetId { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoScaleExpander.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoScaleExpander.cs deleted file mode 100644 index f1aabf76b120..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoScaleExpander.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// 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. - public readonly partial struct AutoScaleExpander : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public AutoScaleExpander(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string LeastWasteValue = "least-waste"; - private const string MostPodsValue = "most-pods"; - private const string PriorityValue = "priority"; - private const string RandomValue = "random"; - - /// Selects the node group that will have the least idle CPU (if tied, unused memory) after scale-up. This is useful when you have different classes of nodes, for example, high CPU or high memory nodes, and only want to expand those when there are pending pods that need a lot of those resources. - public static AutoScaleExpander LeastWaste { get; } = new AutoScaleExpander(LeastWasteValue); - /// Selects the node group that would be able to schedule the most pods when scaling up. This is useful when you are using nodeSelector to make sure certain pods land on certain nodes. Note that this won't cause the autoscaler to select bigger nodes vs. smaller, as it can add multiple smaller nodes at once. - public static AutoScaleExpander MostPods { get; } = new AutoScaleExpander(MostPodsValue); - /// Selects the node group that has the highest priority assigned by the user. It's configuration is described in more details [here](https://github.com/kubernetes/autoscaler/blob/master/cluster-autoscaler/expander/priority/readme.md). - public static AutoScaleExpander Priority { get; } = new AutoScaleExpander(PriorityValue); - /// Used when you don't have a particular need for the node groups to scale differently. - public static AutoScaleExpander Random { get; } = new AutoScaleExpander(RandomValue); - /// Determines if two values are the same. - public static bool operator ==(AutoScaleExpander left, AutoScaleExpander right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(AutoScaleExpander left, AutoScaleExpander right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator AutoScaleExpander(string value) => new AutoScaleExpander(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is AutoScaleExpander other && Equals(other); - /// - public bool Equals(AutoScaleExpander 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/ManagedClusterVerticalPodAutoscaler.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.Serialization.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.Serialization.cs index bb37033fc09e..6287ba3232b7 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class ManagedClusterVerticalPodAutoscaler : IUtf8JsonSerializable, IJsonModel + internal partial class AutoUpgradeNodeImageSelection : 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,14 +29,14 @@ void IJsonModel.Write(Utf8JsonWriter 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ManagedClusterVerticalPodAutoscaler)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeNodeImageSelection)} does not support writing '{format}' format."); } - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsVpaEnabled); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SelectionType.ToString()); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -54,19 +54,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterVerticalPodAutoscaler IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AutoUpgradeNodeImageSelection 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(ManagedClusterVerticalPodAutoscaler)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeNodeImageSelection)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterVerticalPodAutoscaler(document.RootElement, options); + return DeserializeAutoUpgradeNodeImageSelection(document.RootElement, options); } - internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVerticalPodAutoscaler(JsonElement element, ModelReaderWriterOptions options = null) + internal static AutoUpgradeNodeImageSelection DeserializeAutoUpgradeNodeImageSelection(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -74,14 +74,14 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer { return null; } - bool enabled = default; + AutoUpgradeNodeImageSelectionType type = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("enabled"u8)) + if (property.NameEquals("type"u8)) { - enabled = property.Value.GetBoolean(); + type = new AutoUpgradeNodeImageSelectionType(property.Value.GetString()); continue; } if (options.Format != "W") @@ -90,7 +90,7 @@ internal static ManagedClusterVerticalPodAutoscaler DeserializeManagedClusterVer } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterVerticalPodAutoscaler(enabled, serializedAdditionalRawData); + return new AutoUpgradeNodeImageSelection(type, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -104,26 +104,25 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsVpaEnabled), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SelectionType), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" enabled: "); + builder.Append(" type: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" enabled: "); - var boolValue = IsVpaEnabled == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" type: "); + builder.AppendLine($"'{SelectionType.ToString()}'"); } 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) { @@ -132,26 +131,26 @@ BinaryData IPersistableModel.Write(ModelRea case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterVerticalPodAutoscaler)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeNodeImageSelection)} does not support writing '{options.Format}' format."); } } - ManagedClusterVerticalPodAutoscaler IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AutoUpgradeNodeImageSelection 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); - return DeserializeManagedClusterVerticalPodAutoscaler(document.RootElement, options); + return DeserializeAutoUpgradeNodeImageSelection(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterVerticalPodAutoscaler)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeNodeImageSelection)} 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/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.cs index 09e9b07a6801..8682fe1faf21 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolUpgradeProfilePropertiesUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelection.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The AgentPoolUpgradeProfilePropertiesUpgradesItem. - public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem + /// The node image upgrade to be applied to the target clusters in auto upgrade. + internal partial class AutoUpgradeNodeImageSelection { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,29 @@ public partial class AgentPoolUpgradeProfilePropertiesUpgradesItem /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal AgentPoolUpgradeProfilePropertiesUpgradesItem() + /// Initializes a new instance of . + /// The node image upgrade type. + public AutoUpgradeNodeImageSelection(AutoUpgradeNodeImageSelectionType selectionType) { + SelectionType = selectionType; } - /// Initializes a new instance of . - /// The Kubernetes version (major.minor.patch). - /// Whether the Kubernetes version is currently in preview. + /// Initializes a new instance of . + /// The node image upgrade type. /// Keeps track of any properties unknown to the library. - internal AgentPoolUpgradeProfilePropertiesUpgradesItem(string kubernetesVersion, bool? isPreview, IDictionary serializedAdditionalRawData) + internal AutoUpgradeNodeImageSelection(AutoUpgradeNodeImageSelectionType selectionType, IDictionary serializedAdditionalRawData) { - KubernetesVersion = kubernetesVersion; - IsPreview = isPreview; + SelectionType = selectionType; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The Kubernetes version (major.minor.patch). - [WirePath("kubernetesVersion")] - public string KubernetesVersion { get; } - /// Whether the Kubernetes version is currently in preview. - [WirePath("isPreview")] - public bool? IsPreview { get; } + /// Initializes a new instance of for deserialization. + internal AutoUpgradeNodeImageSelection() + { + } + + /// The node image upgrade type. + [WirePath("type")] + public AutoUpgradeNodeImageSelectionType SelectionType { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelectionType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelectionType.cs new file mode 100644 index 000000000000..ed8d50663341 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeNodeImageSelectionType.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 node image upgrade type. + public readonly partial struct AutoUpgradeNodeImageSelectionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AutoUpgradeNodeImageSelectionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LatestValue = "Latest"; + private const string ConsistentValue = "Consistent"; + + /// Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. + public static AutoUpgradeNodeImageSelectionType Latest { get; } = new AutoUpgradeNodeImageSelectionType(LatestValue); + /// The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. + public static AutoUpgradeNodeImageSelectionType Consistent { get; } = new AutoUpgradeNodeImageSelectionType(ConsistentValue); + /// Determines if two values are the same. + public static bool operator ==(AutoUpgradeNodeImageSelectionType left, AutoUpgradeNodeImageSelectionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AutoUpgradeNodeImageSelectionType left, AutoUpgradeNodeImageSelectionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AutoUpgradeNodeImageSelectionType(string value) => new AutoUpgradeNodeImageSelectionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutoUpgradeNodeImageSelectionType other && Equals(other); + /// + public bool Equals(AutoUpgradeNodeImageSelectionType 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/OutboundEnvironmentEndpointListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.Serialization.cs similarity index 65% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.Serialization.cs index 561e8128aec6..b3fc0f9f519c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class OutboundEnvironmentEndpointListResult : IUtf8JsonSerializable, IJsonModel + internal partial class AutoUpgradeProfileListResult : 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); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writ /// 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(OutboundEnvironmentEndpointListResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileListResult)} does not support writing '{format}' format."); } writer.WritePropertyName("value"u8); @@ -43,10 +43,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WriteObjectValue(item, options); } writer.WriteEndArray(); - if (options.Format != "W" && Optional.IsDefined(NextLink)) + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -65,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - OutboundEnvironmentEndpointListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + AutoUpgradeProfileListResult 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(OutboundEnvironmentEndpointListResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOutboundEnvironmentEndpointListResult(document.RootElement, options); + return DeserializeAutoUpgradeProfileListResult(document.RootElement, options); } - internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnvironmentEndpointListResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static AutoUpgradeProfileListResult DeserializeAutoUpgradeProfileListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -85,25 +85,29 @@ internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnviron { return null; } - IReadOnlyList value = default; - string nextLink = default; + IReadOnlyList value = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ContainerServiceOutboundEnvironmentEndpoint.DeserializeContainerServiceOutboundEnvironmentEndpoint(item, options)); + array.Add(AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -112,7 +116,7 @@ internal static OutboundEnvironmentEndpointListResult DeserializeOutboundEnviron } } serializedAdditionalRawData = rawDataDictionary; - return new OutboundEnvironmentEndpointListResult(value, nextLink, serializedAdditionalRawData); + return new AutoUpgradeProfileListResult(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -160,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } @@ -176,9 +172,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -187,26 +183,26 @@ BinaryData IPersistableModel.Write(ModelR case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(OutboundEnvironmentEndpointListResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileListResult)} does not support writing '{options.Format}' format."); } } - OutboundEnvironmentEndpointListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + AutoUpgradeProfileListResult 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); - return DeserializeOutboundEnvironmentEndpointListResult(document.RootElement, options); + return DeserializeAutoUpgradeProfileListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(OutboundEnvironmentEndpointListResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(AutoUpgradeProfileListResult)} 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/OutboundEnvironmentEndpointListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.cs index da8bd850a121..3f7aacb7bc7d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/OutboundEnvironmentEndpointListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileListResult.cs @@ -11,8 +11,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Collection of OutboundEnvironmentEndpoint. - internal partial class OutboundEnvironmentEndpointListResult + /// The response of a AutoUpgradeProfile list operation. + internal partial class AutoUpgradeProfileListResult { /// /// Keeps track of any properties unknown to the library. @@ -46,35 +46,35 @@ internal partial class OutboundEnvironmentEndpointListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Collection of resources. + /// Initializes a new instance of . + /// The AutoUpgradeProfile items on this page. /// is null. - internal OutboundEnvironmentEndpointListResult(IEnumerable value) + internal AutoUpgradeProfileListResult(IEnumerable value) { Argument.AssertNotNull(value, nameof(value)); Value = value.ToList(); } - /// Initializes a new instance of . - /// Collection of resources. - /// Link to next page of resources. + /// Initializes a new instance of . + /// The AutoUpgradeProfile items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal OutboundEnvironmentEndpointListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal AutoUpgradeProfileListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal OutboundEnvironmentEndpointListResult() + /// Initializes a new instance of for deserialization. + internal AutoUpgradeProfileListResult() { } - /// Collection of resources. - public IReadOnlyList Value { get; } - /// Link to next page of resources. - public string NextLink { get; } + /// The AutoUpgradeProfile items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileProvisioningState.cs new file mode 100644 index 000000000000..a19fdb95e608 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AutoUpgradeProfileProvisioningState.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 provisioning state of the AutoUpgradeProfile resource. + public readonly partial struct AutoUpgradeProfileProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AutoUpgradeProfileProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static AutoUpgradeProfileProvisioningState Succeeded { get; } = new AutoUpgradeProfileProvisioningState(SucceededValue); + /// Resource creation failed. + public static AutoUpgradeProfileProvisioningState Failed { get; } = new AutoUpgradeProfileProvisioningState(FailedValue); + /// Resource creation was canceled. + public static AutoUpgradeProfileProvisioningState Canceled { get; } = new AutoUpgradeProfileProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(AutoUpgradeProfileProvisioningState left, AutoUpgradeProfileProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AutoUpgradeProfileProvisioningState left, AutoUpgradeProfileProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AutoUpgradeProfileProvisioningState(string value) => new AutoUpgradeProfileProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutoUpgradeProfileProvisioningState other && Equals(other); + /// + public bool Equals(AutoUpgradeProfileProvisioningState 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/ClusterUpgradeSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterUpgradeSettings.Serialization.cs deleted file mode 100644 index 6c7e49bd44bf..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterUpgradeSettings.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ClusterUpgradeSettings : 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(ClusterUpgradeSettings)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(OverrideSettings)) - { - writer.WritePropertyName("overrideSettings"u8); - writer.WriteObjectValue(OverrideSettings, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ClusterUpgradeSettings 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(ClusterUpgradeSettings)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeClusterUpgradeSettings(document.RootElement, options); - } - - internal static ClusterUpgradeSettings DeserializeClusterUpgradeSettings(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - UpgradeOverrideSettings overrideSettings = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("overrideSettings"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - overrideSettings = UpgradeOverrideSettings.DeserializeUpgradeOverrideSettings(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ClusterUpgradeSettings(overrideSettings, 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(OverrideSettings), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" overrideSettings: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OverrideSettings)) - { - builder.Append(" overrideSettings: "); - BicepSerializationHelpers.AppendChildObject(builder, OverrideSettings, options, 2, false, " overrideSettings: "); - } - } - - 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(ClusterUpgradeSettings)} does not support writing '{options.Format}' format."); - } - } - - ClusterUpgradeSettings 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); - return DeserializeClusterUpgradeSettings(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ClusterUpgradeSettings)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs deleted file mode 100644 index 3f8a5f758d65..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 ContainerServiceAgentPoolListResult : 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(ContainerServiceAgentPoolListResult)} 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceAgentPoolListResult 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(ContainerServiceAgentPoolListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceAgentPoolListResult(document.RootElement, options); - } - - internal static ContainerServiceAgentPoolListResult DeserializeContainerServiceAgentPoolListResult(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(ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(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 ContainerServiceAgentPoolListResult(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(ContainerServiceAgentPoolListResult)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceAgentPoolListResult 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); - return DeserializeContainerServiceAgentPoolListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceAgentPoolListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs deleted file mode 100644 index ac8db1aae181..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceAgentPoolListResult.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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 Agent Pools operation. - internal partial class ContainerServiceAgentPoolListResult - { - /// - /// 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 ContainerServiceAgentPoolListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The list of agent pools. - /// The URL to get the next set of agent pool results. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceAgentPoolListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The list of agent pools. - public IReadOnlyList Value { get; } - /// The URL to get the next set of agent pool results. - public string NextLink { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs deleted file mode 100644 index 01fd98e77e9d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ContainerServiceCreationData : 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(ContainerServiceCreationData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(SourceResourceId)) - { - writer.WritePropertyName("sourceResourceId"u8); - writer.WriteStringValue(SourceResourceId); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceCreationData 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(ContainerServiceCreationData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceCreationData(document.RootElement, options); - } - - internal static ContainerServiceCreationData DeserializeContainerServiceCreationData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier sourceResourceId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sourceResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sourceResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceCreationData(sourceResourceId, 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(SourceResourceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sourceResourceId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SourceResourceId)) - { - builder.Append(" sourceResourceId: "); - builder.AppendLine($"'{SourceResourceId.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(ContainerServiceCreationData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceCreationData 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); - return DeserializeContainerServiceCreationData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceCreationData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs deleted file mode 100644 index 7f2b8a95f130..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceCreationData.cs +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -{ - /// Data used when creating a target resource from a source resource. - internal partial class ContainerServiceCreationData - { - /// - /// 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 ContainerServiceCreationData() - { - } - - /// Initializes a new instance of . - /// This is the ARM ID of the source object to be used to create the target object. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceCreationData(ResourceIdentifier sourceResourceId, IDictionary serializedAdditionalRawData) - { - SourceResourceId = sourceResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// This is the ARM ID of the source object to be used to create the target object. - [WirePath("sourceResourceId")] - public ResourceIdentifier SourceResourceId { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs deleted file mode 100644 index 3bcb3b3773ac..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.Serialization.cs +++ /dev/null @@ -1,178 +0,0 @@ -// 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 ContainerServiceDateSpan : 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(ContainerServiceDateSpan)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("start"u8); - writer.WriteStringValue(Start, "D"); - writer.WritePropertyName("end"u8); - writer.WriteStringValue(End, "D"); - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceDateSpan 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(ContainerServiceDateSpan)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceDateSpan(document.RootElement, options); - } - - internal static ContainerServiceDateSpan DeserializeContainerServiceDateSpan(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DateTimeOffset start = default; - DateTimeOffset end = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("start"u8)) - { - start = property.Value.GetDateTimeOffset("D"); - continue; - } - if (property.NameEquals("end"u8)) - { - end = property.Value.GetDateTimeOffset("D"); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceDateSpan(start, end, 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(Start), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" start: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" start: "); - var formattedDateTimeString = TypeFormatters.ToString(Start, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(End), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" end: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" end: "); - var formattedDateTimeString = TypeFormatters.ToString(End, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - - 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(ContainerServiceDateSpan)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceDateSpan 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); - return DeserializeContainerServiceDateSpan(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceDateSpan)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs deleted file mode 100644 index 7ad8b6823697..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceDateSpan.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// For example, between '2022-12-23' and '2023-01-05'. - public partial class ContainerServiceDateSpan - { - /// - /// 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 start date of the date span. - /// The end date of the date span. - public ContainerServiceDateSpan(DateTimeOffset start, DateTimeOffset end) - { - Start = start; - End = end; - } - - /// Initializes a new instance of . - /// The start date of the date span. - /// The end date of the date span. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceDateSpan(DateTimeOffset start, DateTimeOffset end, IDictionary serializedAdditionalRawData) - { - Start = start; - End = end; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceDateSpan() - { - } - - /// The start date of the date span. - [WirePath("start")] - public DateTimeOffset Start { get; set; } - /// The end date of the date span. - [WirePath("end")] - public DateTimeOffset End { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs deleted file mode 100644 index 6cf09283dae9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 ContainerServiceEndpointDependency : 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(ContainerServiceEndpointDependency)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DomainName)) - { - writer.WritePropertyName("domainName"u8); - writer.WriteStringValue(DomainName); - } - if (Optional.IsCollectionDefined(EndpointDetails)) - { - writer.WritePropertyName("endpointDetails"u8); - writer.WriteStartArray(); - foreach (var item in EndpointDetails) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceEndpointDependency 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(ContainerServiceEndpointDependency)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceEndpointDependency(document.RootElement, options); - } - - internal static ContainerServiceEndpointDependency DeserializeContainerServiceEndpointDependency(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string domainName = default; - IReadOnlyList endpointDetails = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("domainName"u8)) - { - domainName = property.Value.GetString(); - continue; - } - if (property.NameEquals("endpointDetails"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ContainerServiceEndpointDetail.DeserializeContainerServiceEndpointDetail(item, options)); - } - endpointDetails = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceEndpointDependency(domainName, endpointDetails ?? 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(DomainName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" domainName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DomainName)) - { - builder.Append(" domainName: "); - if (DomainName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DomainName}'''"); - } - else - { - builder.AppendLine($"'{DomainName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndpointDetails), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" endpointDetails: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(EndpointDetails)) - { - if (EndpointDetails.Any()) - { - builder.Append(" endpointDetails: "); - builder.AppendLine("["); - foreach (var item in EndpointDetails) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " endpointDetails: "); - } - 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(ContainerServiceEndpointDependency)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceEndpointDependency 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); - return DeserializeContainerServiceEndpointDependency(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceEndpointDependency)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs deleted file mode 100644 index a75d389f9493..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDependency.cs +++ /dev/null @@ -1,72 +0,0 @@ -// 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 domain name that AKS agent nodes are reaching at. - public partial class ContainerServiceEndpointDependency - { - /// - /// 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 ContainerServiceEndpointDependency() - { - EndpointDetails = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The domain name of the dependency. - /// The Ports and Protocols used when connecting to domainName. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceEndpointDependency(string domainName, IReadOnlyList endpointDetails, IDictionary serializedAdditionalRawData) - { - DomainName = domainName; - EndpointDetails = endpointDetails; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The domain name of the dependency. - [WirePath("domainName")] - public string DomainName { get; } - /// The Ports and Protocols used when connecting to domainName. - [WirePath("endpointDetails")] - public IReadOnlyList EndpointDetails { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs deleted file mode 100644 index 0d56d7b4b9a5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.cs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Net; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// connect information from the AKS agent nodes to a single endpoint. - public partial class ContainerServiceEndpointDetail - { - /// - /// 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 ContainerServiceEndpointDetail() - { - } - - /// Initializes a new instance of . - /// An IP Address that Domain Name currently resolves to. - /// The port an endpoint is connected to. - /// The protocol used for connection. - /// Description of the detail. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceEndpointDetail(IPAddress ipAddress, int? port, string protocol, string description, IDictionary serializedAdditionalRawData) - { - IPAddress = ipAddress; - Port = port; - Protocol = protocol; - Description = description; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// An IP Address that Domain Name currently resolves to. - [WirePath("ipAddress")] - public IPAddress IPAddress { get; } - /// The port an endpoint is connected to. - [WirePath("port")] - public int? Port { get; } - /// The protocol used for connection. - [WirePath("protocol")] - public string Protocol { get; } - /// Description of the detail. - [WirePath("description")] - public string Description { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs deleted file mode 100644 index 9bf1bb3ed2e1..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.Serialization.cs +++ /dev/null @@ -1,204 +0,0 @@ -// 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 ContainerServiceIPTag : 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(ContainerServiceIPTag)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IPTagType)) - { - writer.WritePropertyName("ipTagType"u8); - writer.WriteStringValue(IPTagType); - } - if (Optional.IsDefined(Tag)) - { - writer.WritePropertyName("tag"u8); - writer.WriteStringValue(Tag); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceIPTag 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(ContainerServiceIPTag)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceIPTag(document.RootElement, options); - } - - internal static ContainerServiceIPTag DeserializeContainerServiceIPTag(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string ipTagType = default; - string tag = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("ipTagType"u8)) - { - ipTagType = property.Value.GetString(); - continue; - } - if (property.NameEquals("tag"u8)) - { - tag = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceIPTag(ipTagType, tag, 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(IPTagType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ipTagType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IPTagType)) - { - builder.Append(" ipTagType: "); - if (IPTagType.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{IPTagType}'''"); - } - else - { - builder.AppendLine($"'{IPTagType}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Tag)) - { - builder.Append(" tag: "); - if (Tag.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Tag}'''"); - } - else - { - builder.AppendLine($"'{Tag}'"); - } - } - } - - 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(ContainerServiceIPTag)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceIPTag 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); - return DeserializeContainerServiceIPTag(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceIPTag)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs deleted file mode 100644 index 3a9e8639002c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceIPTag.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 the IPTag associated with the object. - public partial class ContainerServiceIPTag - { - /// - /// 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 ContainerServiceIPTag() - { - } - - /// Initializes a new instance of . - /// The IP tag type. Example: RoutingPreference. - /// The value of the IP tag associated with the public IP. Example: Internet. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceIPTag(string ipTagType, string tag, IDictionary serializedAdditionalRawData) - { - IPTagType = ipTagType; - Tag = tag; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The IP tag type. Example: RoutingPreference. - [WirePath("ipTagType")] - public string IPTagType { get; set; } - /// The value of the IP tag associated with the public IP. Example: Internet. - [WirePath("tag")] - public string Tag { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs deleted file mode 100644 index 20d51165b50b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.Serialization.cs +++ /dev/null @@ -1,193 +0,0 @@ -// 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 ContainerServiceLinuxProfile : 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(ContainerServiceLinuxProfile)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("adminUsername"u8); - writer.WriteStringValue(AdminUsername); - writer.WritePropertyName("ssh"u8); - writer.WriteObjectValue(Ssh, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceLinuxProfile 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(ContainerServiceLinuxProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceLinuxProfile(document.RootElement, options); - } - - internal static ContainerServiceLinuxProfile DeserializeContainerServiceLinuxProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string adminUsername = default; - ContainerServiceSshConfiguration ssh = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("adminUsername"u8)) - { - adminUsername = property.Value.GetString(); - continue; - } - if (property.NameEquals("ssh"u8)) - { - ssh = ContainerServiceSshConfiguration.DeserializeContainerServiceSshConfiguration(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceLinuxProfile(adminUsername, ssh, 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(AdminUsername), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" adminUsername: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AdminUsername)) - { - builder.Append(" adminUsername: "); - if (AdminUsername.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AdminUsername}'''"); - } - else - { - builder.AppendLine($"'{AdminUsername}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("SshPublicKeys", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ssh: "); - builder.AppendLine("{"); - builder.Append(" publicKeys: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(Ssh)) - { - builder.Append(" ssh: "); - BicepSerializationHelpers.AppendChildObject(builder, Ssh, options, 2, false, " ssh: "); - } - } - - 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(ContainerServiceLinuxProfile)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceLinuxProfile 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); - return DeserializeContainerServiceLinuxProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceLinuxProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs deleted file mode 100644 index 2e3abc8e697b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLinuxProfile.cs +++ /dev/null @@ -1,90 +0,0 @@ -// 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 for Linux VMs in the container service cluster. - public partial class ContainerServiceLinuxProfile - { - /// - /// 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 administrator username to use for Linux VMs. - /// The SSH configuration for Linux-based VMs running on Azure. - /// or is null. - public ContainerServiceLinuxProfile(string adminUsername, ContainerServiceSshConfiguration ssh) - { - Argument.AssertNotNull(adminUsername, nameof(adminUsername)); - Argument.AssertNotNull(ssh, nameof(ssh)); - - AdminUsername = adminUsername; - Ssh = ssh; - } - - /// Initializes a new instance of . - /// The administrator username to use for Linux VMs. - /// The SSH configuration for Linux-based VMs running on Azure. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceLinuxProfile(string adminUsername, ContainerServiceSshConfiguration ssh, IDictionary serializedAdditionalRawData) - { - AdminUsername = adminUsername; - Ssh = ssh; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceLinuxProfile() - { - } - - /// The administrator username to use for Linux VMs. - [WirePath("adminUsername")] - public string AdminUsername { get; set; } - /// The SSH configuration for Linux-based VMs running on Azure. - internal ContainerServiceSshConfiguration Ssh { get; set; } - /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. - [WirePath("ssh.publicKeys")] - public IList SshPublicKeys - { - get => Ssh is null ? default : Ssh.PublicKeys; - set => Ssh = new ContainerServiceSshConfiguration(value); - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLoadBalancerSku.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLoadBalancerSku.cs deleted file mode 100644 index 256b047ecddd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceLoadBalancerSku.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 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. - public readonly partial struct ContainerServiceLoadBalancerSku : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceLoadBalancerSku(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string StandardValue = "standard"; - private const string BasicValue = "basic"; - - /// Use a a standard Load Balancer. This is the recommended Load Balancer SKU. For more information about on working with the load balancer in the managed cluster, see the [standard Load Balancer](https://docs.microsoft.com/azure/aks/load-balancer-standard) article. - public static ContainerServiceLoadBalancerSku Standard { get; } = new ContainerServiceLoadBalancerSku(StandardValue); - /// Use a basic Load Balancer with limited functionality. - public static ContainerServiceLoadBalancerSku Basic { get; } = new ContainerServiceLoadBalancerSku(BasicValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceLoadBalancerSku left, ContainerServiceLoadBalancerSku right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceLoadBalancerSku left, ContainerServiceLoadBalancerSku right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceLoadBalancerSku(string value) => new ContainerServiceLoadBalancerSku(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceLoadBalancerSku other && Equals(other); - /// - public bool Equals(ContainerServiceLoadBalancerSku 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/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs deleted file mode 100644 index 82dcdd7b85c8..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.Serialization.cs +++ /dev/null @@ -1,176 +0,0 @@ -// 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 ContainerServiceMaintenanceAbsoluteMonthlySchedule : 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(ContainerServiceMaintenanceAbsoluteMonthlySchedule)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("intervalMonths"u8); - writer.WriteNumberValue(IntervalMonths); - writer.WritePropertyName("dayOfMonth"u8); - writer.WriteNumberValue(DayOfMonth); - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceAbsoluteMonthlySchedule 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(ContainerServiceMaintenanceAbsoluteMonthlySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceAbsoluteMonthlySchedule DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int intervalMonths = default; - int dayOfMonth = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("intervalMonths"u8)) - { - intervalMonths = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("dayOfMonth"u8)) - { - dayOfMonth = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceAbsoluteMonthlySchedule(intervalMonths, dayOfMonth, 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(IntervalMonths), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" intervalMonths: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" intervalMonths: "); - builder.AppendLine($"{IntervalMonths}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DayOfMonth), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dayOfMonth: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" dayOfMonth: "); - builder.AppendLine($"{DayOfMonth}"); - } - - 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(ContainerServiceMaintenanceAbsoluteMonthlySchedule)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceAbsoluteMonthlySchedule 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); - return DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceAbsoluteMonthlySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs deleted file mode 100644 index 959d59192af4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceAbsoluteMonthlySchedule.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. - public partial class ContainerServiceMaintenanceAbsoluteMonthlySchedule - { - /// - /// 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 . - /// Specifies the number of months between each set of occurrences. - /// The date of the month. - public ContainerServiceMaintenanceAbsoluteMonthlySchedule(int intervalMonths, int dayOfMonth) - { - IntervalMonths = intervalMonths; - DayOfMonth = dayOfMonth; - } - - /// Initializes a new instance of . - /// Specifies the number of months between each set of occurrences. - /// The date of the month. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceAbsoluteMonthlySchedule(int intervalMonths, int dayOfMonth, IDictionary serializedAdditionalRawData) - { - IntervalMonths = intervalMonths; - DayOfMonth = dayOfMonth; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceMaintenanceAbsoluteMonthlySchedule() - { - } - - /// Specifies the number of months between each set of occurrences. - [WirePath("intervalMonths")] - public int IntervalMonths { get; set; } - /// The date of the month. - [WirePath("dayOfMonth")] - public int DayOfMonth { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs deleted file mode 100644 index 2f445b90f06c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 ContainerServiceMaintenanceConfigurationListResult : 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(ContainerServiceMaintenanceConfigurationListResult)} 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceConfigurationListResult 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(ContainerServiceMaintenanceConfigurationListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceConfigurationListResult DeserializeContainerServiceMaintenanceConfigurationListResult(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(ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(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 ContainerServiceMaintenanceConfigurationListResult(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(ContainerServiceMaintenanceConfigurationListResult)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceConfigurationListResult 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); - return DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceConfigurationListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs deleted file mode 100644 index b9aeaeddc09d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.Serialization.cs +++ /dev/null @@ -1,196 +0,0 @@ -// 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 ContainerServiceMaintenanceRelativeMonthlySchedule : 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(ContainerServiceMaintenanceRelativeMonthlySchedule)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("intervalMonths"u8); - writer.WriteNumberValue(IntervalMonths); - writer.WritePropertyName("weekIndex"u8); - writer.WriteStringValue(WeekIndex.ToString()); - writer.WritePropertyName("dayOfWeek"u8); - writer.WriteStringValue(DayOfWeek.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceRelativeMonthlySchedule 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(ContainerServiceMaintenanceRelativeMonthlySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceRelativeMonthlySchedule DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int intervalMonths = default; - ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex = default; - ContainerServiceWeekDay dayOfWeek = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("intervalMonths"u8)) - { - intervalMonths = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("weekIndex"u8)) - { - weekIndex = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(property.Value.GetString()); - continue; - } - if (property.NameEquals("dayOfWeek"u8)) - { - dayOfWeek = new ContainerServiceWeekDay(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceRelativeMonthlySchedule(intervalMonths, weekIndex, dayOfWeek, 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(IntervalMonths), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" intervalMonths: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" intervalMonths: "); - builder.AppendLine($"{IntervalMonths}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WeekIndex), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" weekIndex: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" weekIndex: "); - builder.AppendLine($"'{WeekIndex.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DayOfWeek), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dayOfWeek: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" dayOfWeek: "); - builder.AppendLine($"'{DayOfWeek.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(ContainerServiceMaintenanceRelativeMonthlySchedule)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceRelativeMonthlySchedule 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); - return DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceRelativeMonthlySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs deleted file mode 100644 index a1efae39f6f4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlySchedule.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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 -{ - /// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. - public partial class ContainerServiceMaintenanceRelativeMonthlySchedule - { - /// - /// 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 . - /// Specifies the number of months between each set of occurrences. - /// Specifies on which week of the month the dayOfWeek applies. - /// Specifies on which day of the week the maintenance occurs. - public ContainerServiceMaintenanceRelativeMonthlySchedule(int intervalMonths, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex weekIndex, ContainerServiceWeekDay dayOfWeek) - { - IntervalMonths = intervalMonths; - WeekIndex = weekIndex; - DayOfWeek = dayOfWeek; - } - - /// 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 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) - { - IntervalMonths = intervalMonths; - WeekIndex = weekIndex; - DayOfWeek = dayOfWeek; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - 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. - [WirePath("weekIndex")] - public ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex WeekIndex { get; set; } - /// Specifies on which day of the week the maintenance occurs. - [WirePath("dayOfWeek")] - public ContainerServiceWeekDay DayOfWeek { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs deleted file mode 100644 index 6039e4261e73..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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 on which week of the month the dayOfWeek applies. - public readonly partial struct ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string FirstValue = "First"; - private const string SecondValue = "Second"; - private const string ThirdValue = "Third"; - private const string FourthValue = "Fourth"; - private const string LastValue = "Last"; - - /// First week of the month. - public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex First { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(FirstValue); - /// Second week of the month. - public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Second { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(SecondValue); - /// Third week of the month. - public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Third { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(ThirdValue); - /// Fourth week of the month. - public static ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex Fourth { get; } = new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(FourthValue); - /// Last week of the month. - 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); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex left, ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(string value) => new ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex other && Equals(other); - /// - public bool Equals(ContainerServiceMaintenanceRelativeMonthlyScheduleWeekIndex 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/ContainerServiceMaintenanceSchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs deleted file mode 100644 index efbb0975ee04..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.Serialization.cs +++ /dev/null @@ -1,259 +0,0 @@ -// 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 ContainerServiceMaintenanceSchedule : 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(ContainerServiceMaintenanceSchedule)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Daily)) - { - writer.WritePropertyName("daily"u8); - writer.WriteObjectValue(Daily, options); - } - if (Optional.IsDefined(Weekly)) - { - writer.WritePropertyName("weekly"u8); - writer.WriteObjectValue(Weekly, options); - } - if (Optional.IsDefined(AbsoluteMonthly)) - { - writer.WritePropertyName("absoluteMonthly"u8); - writer.WriteObjectValue(AbsoluteMonthly, options); - } - if (Optional.IsDefined(RelativeMonthly)) - { - writer.WritePropertyName("relativeMonthly"u8); - writer.WriteObjectValue(RelativeMonthly, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceSchedule 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(ContainerServiceMaintenanceSchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceSchedule(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceSchedule DeserializeContainerServiceMaintenanceSchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - DailySchedule daily = default; - ContainerServiceMaintenanceWeeklySchedule weekly = default; - ContainerServiceMaintenanceAbsoluteMonthlySchedule absoluteMonthly = default; - ContainerServiceMaintenanceRelativeMonthlySchedule relativeMonthly = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("daily"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - daily = DailySchedule.DeserializeDailySchedule(property.Value, options); - continue; - } - if (property.NameEquals("weekly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - weekly = ContainerServiceMaintenanceWeeklySchedule.DeserializeContainerServiceMaintenanceWeeklySchedule(property.Value, options); - continue; - } - if (property.NameEquals("absoluteMonthly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - absoluteMonthly = ContainerServiceMaintenanceAbsoluteMonthlySchedule.DeserializeContainerServiceMaintenanceAbsoluteMonthlySchedule(property.Value, options); - continue; - } - if (property.NameEquals("relativeMonthly"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - relativeMonthly = ContainerServiceMaintenanceRelativeMonthlySchedule.DeserializeContainerServiceMaintenanceRelativeMonthlySchedule(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceSchedule(daily, weekly, absoluteMonthly, relativeMonthly, 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("DailyIntervalDays", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" daily: "); - builder.AppendLine("{"); - builder.Append(" intervalDays: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(Daily)) - { - builder.Append(" daily: "); - BicepSerializationHelpers.AppendChildObject(builder, Daily, options, 2, false, " daily: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Weekly), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" weekly: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Weekly)) - { - builder.Append(" weekly: "); - BicepSerializationHelpers.AppendChildObject(builder, Weekly, options, 2, false, " weekly: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AbsoluteMonthly), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" absoluteMonthly: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AbsoluteMonthly)) - { - builder.Append(" absoluteMonthly: "); - BicepSerializationHelpers.AppendChildObject(builder, AbsoluteMonthly, options, 2, false, " absoluteMonthly: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RelativeMonthly), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" relativeMonthly: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RelativeMonthly)) - { - builder.Append(" relativeMonthly: "); - BicepSerializationHelpers.AppendChildObject(builder, RelativeMonthly, options, 2, false, " relativeMonthly: "); - } - } - - 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(ContainerServiceMaintenanceSchedule)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceSchedule 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); - return DeserializeContainerServiceMaintenanceSchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceSchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs deleted file mode 100644 index 84bd7f144578..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceSchedule.cs +++ /dev/null @@ -1,91 +0,0 @@ -// 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 -{ - /// One and only one of the schedule types should be specified. Choose either 'daily', 'weekly', 'absoluteMonthly' or 'relativeMonthly' for your maintenance schedule. - public partial class ContainerServiceMaintenanceSchedule - { - /// - /// 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 ContainerServiceMaintenanceSchedule() - { - } - - /// Initializes a new instance of . - /// For schedules like: 'recur every day' or 'recur every 3 days'. - /// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. - /// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. - /// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceSchedule(DailySchedule daily, ContainerServiceMaintenanceWeeklySchedule weekly, ContainerServiceMaintenanceAbsoluteMonthlySchedule absoluteMonthly, ContainerServiceMaintenanceRelativeMonthlySchedule relativeMonthly, IDictionary serializedAdditionalRawData) - { - Daily = daily; - Weekly = weekly; - AbsoluteMonthly = absoluteMonthly; - RelativeMonthly = relativeMonthly; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// For schedules like: 'recur every day' or 'recur every 3 days'. - internal DailySchedule Daily { get; set; } - /// Specifies the number of days between each set of occurrences. - [WirePath("daily.intervalDays")] - public int? DailyIntervalDays - { - get => Daily is null ? default(int?) : Daily.IntervalDays; - set - { - Daily = value.HasValue ? new DailySchedule(value.Value) : null; - } - } - - /// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. - [WirePath("weekly")] - public ContainerServiceMaintenanceWeeklySchedule Weekly { get; set; } - /// For schedules like: 'recur every month on the 15th' or 'recur every 3 months on the 20th'. - [WirePath("absoluteMonthly")] - public ContainerServiceMaintenanceAbsoluteMonthlySchedule AbsoluteMonthly { get; set; } - /// For schedules like: 'recur every month on the first Monday' or 'recur every 3 months on last Friday'. - [WirePath("relativeMonthly")] - public ContainerServiceMaintenanceRelativeMonthlySchedule RelativeMonthly { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs deleted file mode 100644 index 54892ad5ef5f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.Serialization.cs +++ /dev/null @@ -1,176 +0,0 @@ -// 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 ContainerServiceMaintenanceWeeklySchedule : 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(ContainerServiceMaintenanceWeeklySchedule)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("intervalWeeks"u8); - writer.WriteNumberValue(IntervalWeeks); - writer.WritePropertyName("dayOfWeek"u8); - writer.WriteStringValue(DayOfWeek.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceWeeklySchedule 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(ContainerServiceMaintenanceWeeklySchedule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceWeeklySchedule(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceWeeklySchedule DeserializeContainerServiceMaintenanceWeeklySchedule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int intervalWeeks = default; - ContainerServiceWeekDay dayOfWeek = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("intervalWeeks"u8)) - { - intervalWeeks = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("dayOfWeek"u8)) - { - dayOfWeek = new ContainerServiceWeekDay(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceWeeklySchedule(intervalWeeks, dayOfWeek, 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(IntervalWeeks), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" intervalWeeks: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" intervalWeeks: "); - builder.AppendLine($"{IntervalWeeks}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DayOfWeek), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dayOfWeek: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" dayOfWeek: "); - builder.AppendLine($"'{DayOfWeek.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(ContainerServiceMaintenanceWeeklySchedule)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceWeeklySchedule 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); - return DeserializeContainerServiceMaintenanceWeeklySchedule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceWeeklySchedule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs deleted file mode 100644 index d2f36bff4fa7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWeeklySchedule.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// For schedules like: 'recur every Monday' or 'recur every 3 weeks on Wednesday'. - public partial class ContainerServiceMaintenanceWeeklySchedule - { - /// - /// 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 . - /// Specifies the number of weeks between each set of occurrences. - /// Specifies on which day of the week the maintenance occurs. - public ContainerServiceMaintenanceWeeklySchedule(int intervalWeeks, ContainerServiceWeekDay dayOfWeek) - { - IntervalWeeks = intervalWeeks; - DayOfWeek = dayOfWeek; - } - - /// Initializes a new instance of . - /// Specifies the number of weeks between each set of occurrences. - /// Specifies on which day of the week the maintenance occurs. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceWeeklySchedule(int intervalWeeks, ContainerServiceWeekDay dayOfWeek, IDictionary serializedAdditionalRawData) - { - IntervalWeeks = intervalWeeks; - DayOfWeek = dayOfWeek; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceMaintenanceWeeklySchedule() - { - } - - /// Specifies the number of weeks between each set of occurrences. - [WirePath("intervalWeeks")] - public int IntervalWeeks { get; set; } - /// Specifies on which day of the week the maintenance occurs. - [WirePath("dayOfWeek")] - public ContainerServiceWeekDay DayOfWeek { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs deleted file mode 100644 index bb4dae4839c7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.Serialization.cs +++ /dev/null @@ -1,334 +0,0 @@ -// 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 ContainerServiceMaintenanceWindow : 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(ContainerServiceMaintenanceWindow)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("schedule"u8); - writer.WriteObjectValue(Schedule, options); - writer.WritePropertyName("durationHours"u8); - writer.WriteNumberValue(DurationHours); - if (Optional.IsDefined(UtcOffset)) - { - writer.WritePropertyName("utcOffset"u8); - writer.WriteStringValue(UtcOffset); - } - if (Optional.IsDefined(StartDate)) - { - writer.WritePropertyName("startDate"u8); - writer.WriteStringValue(StartDate); - } - writer.WritePropertyName("startTime"u8); - writer.WriteStringValue(StartTime); - if (Optional.IsCollectionDefined(NotAllowedDates)) - { - writer.WritePropertyName("notAllowedDates"u8); - writer.WriteStartArray(); - foreach (var item in NotAllowedDates) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceMaintenanceWindow 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(ContainerServiceMaintenanceWindow)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceMaintenanceWindow(document.RootElement, options); - } - - internal static ContainerServiceMaintenanceWindow DeserializeContainerServiceMaintenanceWindow(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ContainerServiceMaintenanceSchedule schedule = default; - int durationHours = default; - string utcOffset = default; - string startDate = default; - string startTime = default; - IList notAllowedDates = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("schedule"u8)) - { - schedule = ContainerServiceMaintenanceSchedule.DeserializeContainerServiceMaintenanceSchedule(property.Value, options); - continue; - } - if (property.NameEquals("durationHours"u8)) - { - durationHours = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("utcOffset"u8)) - { - utcOffset = property.Value.GetString(); - continue; - } - if (property.NameEquals("startDate"u8)) - { - startDate = property.Value.GetString(); - continue; - } - if (property.NameEquals("startTime"u8)) - { - startTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("notAllowedDates"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ContainerServiceDateSpan.DeserializeContainerServiceDateSpan(item, options)); - } - notAllowedDates = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceMaintenanceWindow( - schedule, - durationHours, - utcOffset, - startDate, - startTime, - notAllowedDates ?? 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(Schedule), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" schedule: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Schedule)) - { - builder.Append(" schedule: "); - BicepSerializationHelpers.AppendChildObject(builder, Schedule, options, 2, false, " schedule: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DurationHours), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" durationHours: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" durationHours: "); - builder.AppendLine($"{DurationHours}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UtcOffset), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" utcOffset: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UtcOffset)) - { - builder.Append(" utcOffset: "); - if (UtcOffset.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{UtcOffset}'''"); - } - else - { - builder.AppendLine($"'{UtcOffset}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartDate), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startDate: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartDate)) - { - builder.Append(" startDate: "); - if (StartDate.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{StartDate}'''"); - } - else - { - builder.AppendLine($"'{StartDate}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartTime)) - { - builder.Append(" startTime: "); - if (StartTime.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{StartTime}'''"); - } - else - { - builder.AppendLine($"'{StartTime}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NotAllowedDates), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" notAllowedDates: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NotAllowedDates)) - { - if (NotAllowedDates.Any()) - { - builder.Append(" notAllowedDates: "); - builder.AppendLine("["); - foreach (var item in NotAllowedDates) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " notAllowedDates: "); - } - 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(ContainerServiceMaintenanceWindow)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceMaintenanceWindow 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); - return DeserializeContainerServiceMaintenanceWindow(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceMaintenanceWindow)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs deleted file mode 100644 index ee056bdee8a4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceWindow.cs +++ /dev/null @@ -1,107 +0,0 @@ -// 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 -{ - /// Maintenance window used to configure scheduled auto-upgrade for a Managed Cluster. - public partial class ContainerServiceMaintenanceWindow - { - /// - /// 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 . - /// Recurrence schedule for the maintenance window. - /// Length of maintenance window range from 4 to 24 hours. - /// The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. - /// or is null. - public ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule schedule, int durationHours, string startTime) - { - Argument.AssertNotNull(schedule, nameof(schedule)); - Argument.AssertNotNull(startTime, nameof(startTime)); - - Schedule = schedule; - DurationHours = durationHours; - StartTime = startTime; - NotAllowedDates = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Recurrence schedule for the maintenance window. - /// Length of maintenance window range from 4 to 24 hours. - /// The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'. - /// The date the maintenance window activates. If the current date is before this date, the maintenance window is inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away. - /// The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. - /// Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC time. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceWindow(ContainerServiceMaintenanceSchedule schedule, int durationHours, string utcOffset, string startDate, string startTime, IList notAllowedDates, IDictionary serializedAdditionalRawData) - { - Schedule = schedule; - DurationHours = durationHours; - UtcOffset = utcOffset; - StartDate = startDate; - StartTime = startTime; - NotAllowedDates = notAllowedDates; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ContainerServiceMaintenanceWindow() - { - } - - /// Recurrence schedule for the maintenance window. - [WirePath("schedule")] - public ContainerServiceMaintenanceSchedule Schedule { get; set; } - /// Length of maintenance window range from 4 to 24 hours. - [WirePath("durationHours")] - public int DurationHours { get; set; } - /// The UTC offset in format +/-HH:mm. For example, '+05:30' for IST and '-07:00' for PST. If not specified, the default is '+00:00'. - [WirePath("utcOffset")] - public string UtcOffset { get; set; } - /// The date the maintenance window activates. If the current date is before this date, the maintenance window is inactive and will not be used for upgrades. If not specified, the maintenance window will be active right away. - [WirePath("startDate")] - public string StartDate { get; set; } - /// The start time of the maintenance window. Accepted values are from '00:00' to '23:59'. 'utcOffset' applies to this field. For example: '02:00' with 'utcOffset: +02:00' means UTC time '00:00'. - [WirePath("startTime")] - public string StartTime { get; set; } - /// Date ranges on which upgrade is not allowed. 'utcOffset' applies to this field. For example, with 'utcOffset: +02:00' and 'dateSpan' being '2022-12-23' to '2023-01-03', maintenance will be blocked from '2022-12-22 22:00' to '2023-01-03 22:00' in UTC time. - [WirePath("notAllowedDates")] - public IList NotAllowedDates { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkMode.cs deleted file mode 100644 index 11024d2c0da0..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 cannot be specified if networkPlugin is anything other than 'azure'. - public readonly partial struct ContainerServiceNetworkMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceNetworkMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string TransparentValue = "transparent"; - private const string BridgeValue = "bridge"; - - /// No bridge is created. Intra-VM Pod to Pod communication is through IP routes created by Azure CNI. See [Transparent Mode](https://docs.microsoft.com/azure/aks/faq#transparent-mode) for more information. - public static ContainerServiceNetworkMode Transparent { get; } = new ContainerServiceNetworkMode(TransparentValue); - /// This is no longer supported. - public static ContainerServiceNetworkMode Bridge { get; } = new ContainerServiceNetworkMode(BridgeValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceNetworkMode left, ContainerServiceNetworkMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceNetworkMode left, ContainerServiceNetworkMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceNetworkMode(string value) => new ContainerServiceNetworkMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceNetworkMode other && Equals(other); - /// - public bool Equals(ContainerServiceNetworkMode 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/ContainerServiceNetworkPlugin.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs deleted file mode 100644 index 799f7ff37461..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPlugin.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Network plugin used for building the Kubernetes network. - public readonly partial struct ContainerServiceNetworkPlugin : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceNetworkPlugin(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AzureValue = "azure"; - private const string KubenetValue = "kubenet"; - private const string NoneValue = "none"; - - /// Use the Azure CNI network plugin. See [Azure CNI (advanced) networking](https://docs.microsoft.com/azure/aks/concepts-network#azure-cni-advanced-networking) for more information. - 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. - 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); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceNetworkPlugin left, ContainerServiceNetworkPlugin right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceNetworkPlugin(string value) => new ContainerServiceNetworkPlugin(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceNetworkPlugin other && Equals(other); - /// - public bool Equals(ContainerServiceNetworkPlugin 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/ContainerServiceNetworkPluginMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs deleted file mode 100644 index 6dfaab324dbe..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPluginMode.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 mode the network plugin should use. - public readonly partial struct ContainerServiceNetworkPluginMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceNetworkPluginMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(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. - 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); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceNetworkPluginMode left, ContainerServiceNetworkPluginMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceNetworkPluginMode(string value) => new ContainerServiceNetworkPluginMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceNetworkPluginMode other && Equals(other); - /// - public bool Equals(ContainerServiceNetworkPluginMode 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/ContainerServiceNetworkPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs deleted file mode 100644 index 1c5d4ee4d4a2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkPolicy.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Network policy used for building the Kubernetes network. - public readonly partial struct ContainerServiceNetworkPolicy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceNetworkPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CalicoValue = "calico"; - private const string AzureValue = "azure"; - private const string CiliumValue = "cilium"; - - /// 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. - public static ContainerServiceNetworkPolicy Azure { get; } = new ContainerServiceNetworkPolicy(AzureValue); - /// Use Cilium to enforce network policies. This requires networkDataplane to be 'cilium'. - public static ContainerServiceNetworkPolicy Cilium { get; } = new ContainerServiceNetworkPolicy(CiliumValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceNetworkPolicy left, ContainerServiceNetworkPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceNetworkPolicy left, ContainerServiceNetworkPolicy right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceNetworkPolicy(string value) => new ContainerServiceNetworkPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceNetworkPolicy other && Equals(other); - /// - public bool Equals(ContainerServiceNetworkPolicy 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/ContainerServiceNetworkProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs deleted file mode 100644 index 9c13ae4250df..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.Serialization.cs +++ /dev/null @@ -1,695 +0,0 @@ -// 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 ContainerServiceNetworkProfile : 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(ContainerServiceNetworkProfile)} 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(NetworkDataplane)) - { - writer.WritePropertyName("networkDataplane"u8); - writer.WriteStringValue(NetworkDataplane.Value.ToString()); - } - if (Optional.IsDefined(PodCidr)) - { - writer.WritePropertyName("podCidr"u8); - writer.WriteStringValue(PodCidr); - } - if (Optional.IsDefined(ServiceCidr)) - { - writer.WritePropertyName("serviceCidr"u8); - writer.WriteStringValue(ServiceCidr); - } - if (Optional.IsDefined(DnsServiceIP)) - { - writer.WritePropertyName("dnsServiceIP"u8); - writer.WriteStringValue(DnsServiceIP); - } - if (Optional.IsDefined(OutboundType)) - { - writer.WritePropertyName("outboundType"u8); - writer.WriteStringValue(OutboundType.Value.ToString()); - } - if (Optional.IsDefined(LoadBalancerSku)) - { - writer.WritePropertyName("loadBalancerSku"u8); - writer.WriteStringValue(LoadBalancerSku.Value.ToString()); - } - if (Optional.IsDefined(LoadBalancerProfile)) - { - writer.WritePropertyName("loadBalancerProfile"u8); - writer.WriteObjectValue(LoadBalancerProfile, options); - } - if (Optional.IsDefined(NatGatewayProfile)) - { - writer.WritePropertyName("natGatewayProfile"u8); - writer.WriteObjectValue(NatGatewayProfile, options); - } - if (Optional.IsCollectionDefined(PodCidrs)) - { - writer.WritePropertyName("podCidrs"u8); - writer.WriteStartArray(); - foreach (var item in PodCidrs) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(ServiceCidrs)) - { - writer.WritePropertyName("serviceCidrs"u8); - writer.WriteStartArray(); - foreach (var item in ServiceCidrs) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(IPFamilies)) - { - writer.WritePropertyName("ipFamilies"u8); - writer.WriteStartArray(); - foreach (var item in IPFamilies) - { - writer.WriteStringValue(item.ToString()); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceNetworkProfile 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(ContainerServiceNetworkProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceNetworkProfile(document.RootElement, options); - } - - internal static ContainerServiceNetworkProfile DeserializeContainerServiceNetworkProfile(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; - NetworkDataplane? networkDataplane = default; - string podCidr = default; - string serviceCidr = default; - string dnsServiceIP = default; - ContainerServiceOutboundType? outboundType = default; - ContainerServiceLoadBalancerSku? loadBalancerSku = default; - ManagedClusterLoadBalancerProfile loadBalancerProfile = default; - ManagedClusterNatGatewayProfile natGatewayProfile = default; - IList podCidrs = default; - IList serviceCidrs = default; - IList ipFamilies = 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("networkDataplane"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkDataplane = new NetworkDataplane(property.Value.GetString()); - continue; - } - if (property.NameEquals("podCidr"u8)) - { - podCidr = property.Value.GetString(); - continue; - } - if (property.NameEquals("serviceCidr"u8)) - { - serviceCidr = property.Value.GetString(); - continue; - } - if (property.NameEquals("dnsServiceIP"u8)) - { - dnsServiceIP = property.Value.GetString(); - continue; - } - if (property.NameEquals("outboundType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - outboundType = new ContainerServiceOutboundType(property.Value.GetString()); - continue; - } - if (property.NameEquals("loadBalancerSku"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loadBalancerSku = new ContainerServiceLoadBalancerSku(property.Value.GetString()); - continue; - } - if (property.NameEquals("loadBalancerProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - loadBalancerProfile = ManagedClusterLoadBalancerProfile.DeserializeManagedClusterLoadBalancerProfile(property.Value, options); - continue; - } - if (property.NameEquals("natGatewayProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - natGatewayProfile = ManagedClusterNatGatewayProfile.DeserializeManagedClusterNatGatewayProfile(property.Value, options); - continue; - } - if (property.NameEquals("podCidrs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - podCidrs = array; - continue; - } - if (property.NameEquals("serviceCidrs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - serviceCidrs = array; - continue; - } - if (property.NameEquals("ipFamilies"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new IPFamily(item.GetString())); - } - ipFamilies = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceNetworkProfile( - networkPlugin, - networkPluginMode, - networkPolicy, - networkMode, - networkDataplane, - podCidr, - serviceCidr, - dnsServiceIP, - outboundType, - loadBalancerSku, - loadBalancerProfile, - natGatewayProfile, - podCidrs ?? new ChangeTrackingList(), - serviceCidrs ?? new ChangeTrackingList(), - ipFamilies ?? 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(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(NetworkDataplane), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" networkDataplane: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetworkDataplane)) - { - builder.Append(" networkDataplane: "); - builder.AppendLine($"'{NetworkDataplane.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodCidr), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podCidr: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodCidr)) - { - builder.Append(" podCidr: "); - if (PodCidr.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PodCidr}'''"); - } - else - { - builder.AppendLine($"'{PodCidr}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceCidr), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serviceCidr: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServiceCidr)) - { - builder.Append(" serviceCidr: "); - if (ServiceCidr.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ServiceCidr}'''"); - } - else - { - builder.AppendLine($"'{ServiceCidr}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsServiceIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dnsServiceIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DnsServiceIP)) - { - builder.Append(" dnsServiceIP: "); - if (DnsServiceIP.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DnsServiceIP}'''"); - } - else - { - builder.AppendLine($"'{DnsServiceIP}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OutboundType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" outboundType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OutboundType)) - { - builder.Append(" outboundType: "); - builder.AppendLine($"'{OutboundType.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()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LoadBalancerProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" loadBalancerProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LoadBalancerProfile)) - { - builder.Append(" loadBalancerProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, LoadBalancerProfile, options, 2, false, " loadBalancerProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NatGatewayProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" natGatewayProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NatGatewayProfile)) - { - builder.Append(" natGatewayProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, NatGatewayProfile, options, 2, false, " natGatewayProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodCidrs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podCidrs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PodCidrs)) - { - if (PodCidrs.Any()) - { - builder.Append(" podCidrs: "); - builder.AppendLine("["); - foreach (var item in PodCidrs) - { - 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(ServiceCidrs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serviceCidrs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ServiceCidrs)) - { - if (ServiceCidrs.Any()) - { - builder.Append(" serviceCidrs: "); - builder.AppendLine("["); - foreach (var item in ServiceCidrs) - { - 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(IPFamilies), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ipFamilies: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(IPFamilies)) - { - if (IPFamilies.Any()) - { - builder.Append(" ipFamilies: "); - builder.AppendLine("["); - foreach (var item in IPFamilies) - { - builder.AppendLine($" '{item.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(ContainerServiceNetworkProfile)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceNetworkProfile 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); - return DeserializeContainerServiceNetworkProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceNetworkProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs deleted file mode 100644 index 81d5eb5c1e36..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceNetworkProfile.cs +++ /dev/null @@ -1,139 +0,0 @@ -// 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 network configuration. - public partial class ContainerServiceNetworkProfile - { - /// - /// 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 ContainerServiceNetworkProfile() - { - PodCidrs = new ChangeTrackingList(); - ServiceCidrs = new ChangeTrackingList(); - IPFamilies = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Network plugin used for building the Kubernetes network. - /// The mode the network plugin should use. - /// 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. - /// A CIDR notation IP range from which to assign pod IPs when kubenet is used. - /// A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. - /// An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. - /// This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). - /// 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. - /// 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. - /// 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) - { - NetworkPlugin = networkPlugin; - NetworkPluginMode = networkPluginMode; - NetworkPolicy = networkPolicy; - NetworkMode = networkMode; - NetworkDataplane = networkDataplane; - PodCidr = podCidr; - ServiceCidr = serviceCidr; - DnsServiceIP = dnsServiceIP; - OutboundType = outboundType; - LoadBalancerSku = loadBalancerSku; - LoadBalancerProfile = loadBalancerProfile; - NatGatewayProfile = natGatewayProfile; - PodCidrs = podCidrs; - ServiceCidrs = serviceCidrs; - IPFamilies = ipFamilies; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Network plugin used for building the Kubernetes network. - [WirePath("networkPlugin")] - public ContainerServiceNetworkPlugin? NetworkPlugin { get; set; } - /// The mode the network plugin should use. - [WirePath("networkPluginMode")] - public ContainerServiceNetworkPluginMode? NetworkPluginMode { get; set; } - /// Network policy used for building the Kubernetes network. - [WirePath("networkPolicy")] - public ContainerServiceNetworkPolicy? NetworkPolicy { get; set; } - /// This cannot be specified if networkPlugin is anything other than 'azure'. - [WirePath("networkMode")] - public ContainerServiceNetworkMode? NetworkMode { get; set; } - /// Network dataplane used in the Kubernetes cluster. - [WirePath("networkDataplane")] - public NetworkDataplane? NetworkDataplane { get; set; } - /// A CIDR notation IP range from which to assign pod IPs when kubenet is used. - [WirePath("podCidr")] - public string PodCidr { get; set; } - /// A CIDR notation IP range from which to assign service cluster IPs. It must not overlap with any Subnet IP ranges. - [WirePath("serviceCidr")] - public string ServiceCidr { get; set; } - /// An IP address assigned to the Kubernetes DNS service. It must be within the Kubernetes service address range specified in serviceCidr. - [WirePath("dnsServiceIP")] - public string DnsServiceIP { get; set; } - /// This can only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). - [WirePath("outboundType")] - public ContainerServiceOutboundType? OutboundType { get; set; } - /// 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. - [WirePath("loadBalancerSku")] - public ContainerServiceLoadBalancerSku? LoadBalancerSku { get; set; } - /// Profile of the cluster load balancer. - [WirePath("loadBalancerProfile")] - public ManagedClusterLoadBalancerProfile LoadBalancerProfile { get; set; } - /// Profile of the cluster NAT gateway. - [WirePath("natGatewayProfile")] - public ManagedClusterNatGatewayProfile NatGatewayProfile { get; set; } - /// 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; } - /// 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. - [WirePath("serviceCidrs")] - public IList ServiceCidrs { get; } - /// 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; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSDiskType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSDiskType.cs deleted file mode 100644 index fd48e149d05c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSDiskType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 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). - public readonly partial struct ContainerServiceOSDiskType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceOSDiskType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ManagedValue = "Managed"; - private const string EphemeralValue = "Ephemeral"; - - /// Azure replicates the operating system disk for a virtual machine to Azure storage to avoid data loss should the VM need to be relocated to another host. Since containers aren't designed to have local state persisted, this behavior offers limited value while providing some drawbacks, including slower node provisioning and higher read/write latency. - public static ContainerServiceOSDiskType Managed { get; } = new ContainerServiceOSDiskType(ManagedValue); - /// Ephemeral OS disks are stored only on the host machine, just like a temporary disk. This provides lower read/write latency, along with faster node scaling and cluster upgrades. - public static ContainerServiceOSDiskType Ephemeral { get; } = new ContainerServiceOSDiskType(EphemeralValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceOSDiskType left, ContainerServiceOSDiskType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceOSDiskType left, ContainerServiceOSDiskType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceOSDiskType(string value) => new ContainerServiceOSDiskType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceOSDiskType other && Equals(other); - /// - public bool Equals(ContainerServiceOSDiskType 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/ContainerServiceOSOptionProperty.Serialization.cs deleted file mode 100644 index 8843dd9a5ffa..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.Serialization.cs +++ /dev/null @@ -1,188 +0,0 @@ -// 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 ContainerServiceOSOptionProperty : 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(ContainerServiceOSOptionProperty)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("os-type"u8); - writer.WriteStringValue(OSType); - writer.WritePropertyName("enable-fips-image"u8); - writer.WriteBooleanValue(EnableFipsImage); - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceOSOptionProperty 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(ContainerServiceOSOptionProperty)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); - } - - internal static ContainerServiceOSOptionProperty DeserializeContainerServiceOSOptionProperty(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string osType = default; - bool enableFipsImage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("os-type"u8)) - { - osType = property.Value.GetString(); - continue; - } - if (property.NameEquals("enable-fips-image"u8)) - { - enableFipsImage = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceOSOptionProperty(osType, enableFipsImage, 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(OSType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" os-type: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSType)) - { - builder.Append(" os-type: "); - if (OSType.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OSType}'''"); - } - else - { - builder.AppendLine($"'{OSType}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFipsImage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enable-fips-image: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enable-fips-image: "); - var boolValue = EnableFipsImage == 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(ContainerServiceOSOptionProperty)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceOSOptionProperty 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); - return DeserializeContainerServiceOSOptionProperty(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceOSOptionProperty)} 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/ContainerServiceOSOptionProperty.cs deleted file mode 100644 index 38edc7fbc43c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSOptionProperty.cs +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -{ - /// OS option property. - public partial class ContainerServiceOSOptionProperty - { - /// - /// 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 OS type. - /// Whether the image is FIPS-enabled. - /// is null. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage) - { - Argument.AssertNotNull(osType, nameof(osType)); - - OSType = osType; - EnableFipsImage = enableFipsImage; - } - - /// Initializes a new instance of . - /// The OS type. - /// Whether the image is FIPS-enabled. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceOSOptionProperty(string osType, bool enableFipsImage, IDictionary serializedAdditionalRawData) - { - OSType = osType; - EnableFipsImage = enableFipsImage; - _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; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs deleted file mode 100644 index 81fcdb956927..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSSku.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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 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. - public readonly partial struct ContainerServiceOSSku : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceOSSku(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string UbuntuValue = "Ubuntu"; - private const string AzureLinuxValue = "AzureLinux"; - private const string CblMarinerValue = "CBLMariner"; - private const string Windows2019Value = "Windows2019"; - private const string Windows2022Value = "Windows2022"; - - /// Use Ubuntu as the OS for node images. - public static ContainerServiceOSSku Ubuntu { get; } = new ContainerServiceOSSku(UbuntuValue); - /// 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. - public static ContainerServiceOSSku CblMariner { get; } = new ContainerServiceOSSku(CblMarinerValue); - /// Use Windows2019 as the OS for node images. Unsupported for system node pools. Windows2019 only supports Windows2019 containers; it cannot run Windows2022 containers and vice versa. - 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); - /// 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. - public static bool operator !=(ContainerServiceOSSku left, ContainerServiceOSSku right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceOSSku(string value) => new ContainerServiceOSSku(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceOSSku other && Equals(other); - /// - public bool Equals(ContainerServiceOSSku 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/ContainerServiceOSType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSType.cs deleted file mode 100644 index a3bf9fe12835..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOSType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 operating system type. The default is Linux. - public readonly partial struct ContainerServiceOSType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceOSType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string LinuxValue = "Linux"; - private const string WindowsValue = "Windows"; - - /// Use Linux. - public static ContainerServiceOSType Linux { get; } = new ContainerServiceOSType(LinuxValue); - /// Use Windows. - public static ContainerServiceOSType Windows { get; } = new ContainerServiceOSType(WindowsValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceOSType left, ContainerServiceOSType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceOSType left, ContainerServiceOSType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceOSType(string value) => new ContainerServiceOSType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceOSType other && Equals(other); - /// - public bool Equals(ContainerServiceOSType 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/ContainerServiceOutboundEnvironmentEndpoint.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs deleted file mode 100644 index 69ff05cc65f2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.cs +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -{ - /// Egress endpoints which AKS agent nodes connect to for common purpose. - public partial class ContainerServiceOutboundEnvironmentEndpoint - { - /// - /// 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 ContainerServiceOutboundEnvironmentEndpoint() - { - Endpoints = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. - /// The endpoints that AKS agent nodes connect to. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceOutboundEnvironmentEndpoint(string category, IReadOnlyList endpoints, IDictionary serializedAdditionalRawData) - { - Category = category; - Endpoints = endpoints; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The category of endpoints accessed by the AKS agent node, e.g. azure-resource-management, apiserver, etc. - [WirePath("category")] - public string Category { get; } - /// The endpoints that AKS agent nodes connect to. - [WirePath("endpoints")] - public IReadOnlyList Endpoints { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs deleted file mode 100644 index 83a57bc5aa79..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundType.cs +++ /dev/null @@ -1,57 +0,0 @@ -// 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 only be set at cluster creation time and cannot be changed later. For more information see [egress outbound type](https://docs.microsoft.com/azure/aks/egress-outboundtype). - public readonly partial struct ContainerServiceOutboundType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceOutboundType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string LoadBalancerValue = "loadBalancer"; - private const string UserDefinedRoutingValue = "userDefinedRouting"; - private const string ManagedNatGatewayValue = "managedNATGateway"; - private const string UserAssignedNatGatewayValue = "userAssignedNATGateway"; - - /// 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); - /// Egress paths must be defined by the user. This is an advanced scenario and requires proper network configuration. For more information see [outbound type userDefinedRouting](https://docs.microsoft.com/azure/aks/egress-outboundtype#outbound-type-of-userdefinedrouting). - public static ContainerServiceOutboundType UserDefinedRouting { get; } = new ContainerServiceOutboundType(UserDefinedRoutingValue); - /// The AKS-managed NAT gateway is used for egress. - 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); - /// 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. - public static bool operator !=(ContainerServiceOutboundType left, ContainerServiceOutboundType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceOutboundType(string value) => new ContainerServiceOutboundType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceOutboundType other && Equals(other); - /// - public bool Equals(ContainerServiceOutboundType 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/ContainerServicePowerState.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs deleted file mode 100644 index c911cadae0bf..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ContainerServicePowerState : 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(ContainerServicePowerState)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Code)) - { - writer.WritePropertyName("code"u8); - writer.WriteStringValue(Code.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServicePowerState 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(ContainerServicePowerState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePowerState(document.RootElement, options); - } - - internal static ContainerServicePowerState DeserializeContainerServicePowerState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ContainerServiceStateCode? code = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - code = new ContainerServiceStateCode(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePowerState(code, 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(Code), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" code: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Code)) - { - builder.Append(" code: "); - builder.AppendLine($"'{Code.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(ContainerServicePowerState)} does not support writing '{options.Format}' format."); - } - } - - ContainerServicePowerState 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); - return DeserializeContainerServicePowerState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServicePowerState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs deleted file mode 100644 index e566a937e1b5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.Serialization.cs +++ /dev/null @@ -1,185 +0,0 @@ -// 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 ContainerServicePrivateEndpointConnectionListResult : 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(ContainerServicePrivateEndpointConnectionListResult)} 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" && _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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServicePrivateEndpointConnectionListResult 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(ContainerServicePrivateEndpointConnectionListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePrivateEndpointConnectionListResult(document.RootElement, options); - } - - internal static ContainerServicePrivateEndpointConnectionListResult DeserializeContainerServicePrivateEndpointConnectionListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = 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(ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(item, options)); - } - value = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePrivateEndpointConnectionListResult(value ?? 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(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(" ]"); - } - } - } - - 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(ContainerServicePrivateEndpointConnectionListResult)} does not support writing '{options.Format}' format."); - } - } - - ContainerServicePrivateEndpointConnectionListResult 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); - return DeserializeContainerServicePrivateEndpointConnectionListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServicePrivateEndpointConnectionListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionProvisioningState.cs deleted file mode 100644 index 34aab41f51fc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionProvisioningState.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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. - public readonly partial struct ContainerServicePrivateEndpointConnectionProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServicePrivateEndpointConnectionProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CanceledValue = "Canceled"; - private const string CreatingValue = "Creating"; - private const string DeletingValue = "Deleting"; - private const string FailedValue = "Failed"; - private const string SucceededValue = "Succeeded"; - - /// Canceled. - public static ContainerServicePrivateEndpointConnectionProvisioningState Canceled { get; } = new ContainerServicePrivateEndpointConnectionProvisioningState(CanceledValue); - /// Creating. - public static ContainerServicePrivateEndpointConnectionProvisioningState Creating { get; } = new ContainerServicePrivateEndpointConnectionProvisioningState(CreatingValue); - /// Deleting. - public static ContainerServicePrivateEndpointConnectionProvisioningState Deleting { get; } = new ContainerServicePrivateEndpointConnectionProvisioningState(DeletingValue); - /// Failed. - public static ContainerServicePrivateEndpointConnectionProvisioningState Failed { get; } = new ContainerServicePrivateEndpointConnectionProvisioningState(FailedValue); - /// Succeeded. - public static ContainerServicePrivateEndpointConnectionProvisioningState Succeeded { get; } = new ContainerServicePrivateEndpointConnectionProvisioningState(SucceededValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServicePrivateEndpointConnectionProvisioningState left, ContainerServicePrivateEndpointConnectionProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServicePrivateEndpointConnectionProvisioningState left, ContainerServicePrivateEndpointConnectionProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServicePrivateEndpointConnectionProvisioningState(string value) => new ContainerServicePrivateEndpointConnectionProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServicePrivateEndpointConnectionProvisioningState other && Equals(other); - /// - public bool Equals(ContainerServicePrivateEndpointConnectionProvisioningState 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/ContainerServicePrivateLinkResourceData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs deleted file mode 100644 index 1a16263ca528..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.Serialization.cs +++ /dev/null @@ -1,348 +0,0 @@ -// 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 ContainerServicePrivateLinkResourceData : 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(ContainerServicePrivateLinkResourceData)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(ResourceType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType.Value); - } - if (Optional.IsDefined(GroupId)) - { - writer.WritePropertyName("groupId"u8); - writer.WriteStringValue(GroupId); - } - if (Optional.IsCollectionDefined(RequiredMembers)) - { - writer.WritePropertyName("requiredMembers"u8); - writer.WriteStartArray(); - foreach (var item in RequiredMembers) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsDefined(PrivateLinkServiceId)) - { - writer.WritePropertyName("privateLinkServiceID"u8); - writer.WriteStringValue(PrivateLinkServiceId); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServicePrivateLinkResourceData 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(ContainerServicePrivateLinkResourceData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePrivateLinkResourceData(document.RootElement, options); - } - - internal static ContainerServicePrivateLinkResourceData DeserializeContainerServicePrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier id = default; - string name = default; - ResourceType? type = default; - string groupId = default; - IList requiredMembers = default; - ResourceIdentifier privateLinkServiceId = 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("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("groupId"u8)) - { - groupId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requiredMembers"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - requiredMembers = array; - continue; - } - if (property.NameEquals("privateLinkServiceID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - privateLinkServiceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePrivateLinkResourceData( - id, - name, - type, - groupId, - requiredMembers ?? new ChangeTrackingList(), - privateLinkServiceId, - 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(GroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" groupId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GroupId)) - { - builder.Append(" groupId: "); - if (GroupId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{GroupId}'''"); - } - else - { - builder.AppendLine($"'{GroupId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequiredMembers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" requiredMembers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(RequiredMembers)) - { - if (RequiredMembers.Any()) - { - builder.Append(" requiredMembers: "); - builder.AppendLine("["); - foreach (var item in RequiredMembers) - { - 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(PrivateLinkServiceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateLinkServiceID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateLinkServiceId)) - { - builder.Append(" privateLinkServiceID: "); - builder.AppendLine($"'{PrivateLinkServiceId.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(ContainerServicePrivateLinkResourceData)} does not support writing '{options.Format}' format."); - } - } - - ContainerServicePrivateLinkResourceData 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); - return DeserializeContainerServicePrivateLinkResourceData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServicePrivateLinkResourceData)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs deleted file mode 100644 index 147137017b26..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourceData.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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 -{ - /// A private link resource. - public partial class ContainerServicePrivateLinkResourceData - { - /// - /// 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 ContainerServicePrivateLinkResourceData() - { - RequiredMembers = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The ID of the private link resource. - /// The name of the private link resource. - /// The resource type. - /// The group ID of the resource. - /// The RequiredMembers of the resource. - /// The private link service ID of the resource, this field is exposed only to NRP internally. - /// Keeps track of any properties unknown to the library. - internal ContainerServicePrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType? resourceType, string groupId, IList requiredMembers, ResourceIdentifier privateLinkServiceId, IDictionary serializedAdditionalRawData) - { - Id = id; - Name = name; - ResourceType = resourceType; - GroupId = groupId; - RequiredMembers = requiredMembers; - PrivateLinkServiceId = privateLinkServiceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ID of the private link resource. - [WirePath("id")] - public ResourceIdentifier Id { get; set; } - /// The name of the private link resource. - [WirePath("name")] - public string Name { get; set; } - /// The resource type. - [WirePath("type")] - public ResourceType? ResourceType { get; set; } - /// The group ID of the resource. - [WirePath("groupId")] - public string GroupId { get; set; } - /// The RequiredMembers of the resource. - [WirePath("requiredMembers")] - public IList RequiredMembers { get; } - /// The private link service ID of the resource, this field is exposed only to NRP internally. - [WirePath("privateLinkServiceID")] - public ResourceIdentifier PrivateLinkServiceId { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs deleted file mode 100644 index 7c6a3cf7434f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.Serialization.cs +++ /dev/null @@ -1,185 +0,0 @@ -// 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 ContainerServicePrivateLinkResourcesListResult : 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(ContainerServicePrivateLinkResourcesListResult)} 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" && _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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServicePrivateLinkResourcesListResult 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(ContainerServicePrivateLinkResourcesListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePrivateLinkResourcesListResult(document.RootElement, options); - } - - internal static ContainerServicePrivateLinkResourcesListResult DeserializeContainerServicePrivateLinkResourcesListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = 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(ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(item, options)); - } - value = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePrivateLinkResourcesListResult(value ?? 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(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(" ]"); - } - } - } - - 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(ContainerServicePrivateLinkResourcesListResult)} does not support writing '{options.Format}' format."); - } - } - - ContainerServicePrivateLinkResourcesListResult 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); - return DeserializeContainerServicePrivateLinkResourcesListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServicePrivateLinkResourcesListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs deleted file mode 100644 index 55fb1f26e10d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkResourcesListResult.cs +++ /dev/null @@ -1,67 +0,0 @@ -// 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 list of private link resources. - internal partial class ContainerServicePrivateLinkResourcesListResult - { - /// - /// 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 ContainerServicePrivateLinkResourcesListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The collection value. - /// Keeps track of any properties unknown to the library. - internal ContainerServicePrivateLinkResourcesListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) - { - Value = value; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The collection value. - [WirePath("value")] - public IReadOnlyList Value { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs deleted file mode 100644 index c5257a636298..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.Serialization.cs +++ /dev/null @@ -1,200 +0,0 @@ -// 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 ContainerServicePrivateLinkServiceConnectionState : 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(ContainerServicePrivateLinkServiceConnectionState)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Status)) - { - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.Value.ToString()); - } - if (Optional.IsDefined(Description)) - { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServicePrivateLinkServiceConnectionState 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(ContainerServicePrivateLinkServiceConnectionState)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServicePrivateLinkServiceConnectionState(document.RootElement, options); - } - - internal static ContainerServicePrivateLinkServiceConnectionState DeserializeContainerServicePrivateLinkServiceConnectionState(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ContainerServicePrivateLinkServiceConnectionStatus? status = default; - string description = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("status"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - status = new ContainerServicePrivateLinkServiceConnectionStatus(property.Value.GetString()); - continue; - } - if (property.NameEquals("description"u8)) - { - description = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServicePrivateLinkServiceConnectionState(status, description, 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(Status), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" status: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Status)) - { - builder.Append(" status: "); - builder.AppendLine($"'{Status.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" description: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Description)) - { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } - } - } - - 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(ContainerServicePrivateLinkServiceConnectionState)} does not support writing '{options.Format}' format."); - } - } - - ContainerServicePrivateLinkServiceConnectionState 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); - return DeserializeContainerServicePrivateLinkServiceConnectionState(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServicePrivateLinkServiceConnectionState)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionStatus.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionStatus.cs deleted file mode 100644 index 4a5af70e8db7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionStatus.cs +++ /dev/null @@ -1,57 +0,0 @@ -// 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 private link service connection status. - public readonly partial struct ContainerServicePrivateLinkServiceConnectionStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServicePrivateLinkServiceConnectionStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PendingValue = "Pending"; - private const string ApprovedValue = "Approved"; - private const string RejectedValue = "Rejected"; - private const string DisconnectedValue = "Disconnected"; - - /// Pending. - public static ContainerServicePrivateLinkServiceConnectionStatus Pending { get; } = new ContainerServicePrivateLinkServiceConnectionStatus(PendingValue); - /// Approved. - public static ContainerServicePrivateLinkServiceConnectionStatus Approved { get; } = new ContainerServicePrivateLinkServiceConnectionStatus(ApprovedValue); - /// Rejected. - public static ContainerServicePrivateLinkServiceConnectionStatus Rejected { get; } = new ContainerServicePrivateLinkServiceConnectionStatus(RejectedValue); - /// Disconnected. - public static ContainerServicePrivateLinkServiceConnectionStatus Disconnected { get; } = new ContainerServicePrivateLinkServiceConnectionStatus(DisconnectedValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServicePrivateLinkServiceConnectionStatus left, ContainerServicePrivateLinkServiceConnectionStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServicePrivateLinkServiceConnectionStatus left, ContainerServicePrivateLinkServiceConnectionStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServicePrivateLinkServiceConnectionStatus(string value) => new ContainerServicePrivateLinkServiceConnectionStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServicePrivateLinkServiceConnectionStatus other && Equals(other); - /// - public bool Equals(ContainerServicePrivateLinkServiceConnectionStatus 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/ContainerServicePublicNetworkAccess.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs deleted file mode 100644 index 3ccaa95a3517..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePublicNetworkAccess.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Allow or deny public network access for AKS. - public readonly partial struct ContainerServicePublicNetworkAccess : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServicePublicNetworkAccess(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string EnabledValue = "Enabled"; - private const string DisabledValue = "Disabled"; - - /// Enabled. - public static ContainerServicePublicNetworkAccess Enabled { get; } = new ContainerServicePublicNetworkAccess(EnabledValue); - /// Disabled. - public static ContainerServicePublicNetworkAccess Disabled { get; } = new ContainerServicePublicNetworkAccess(DisabledValue); - /// 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. - public static bool operator !=(ContainerServicePublicNetworkAccess left, ContainerServicePublicNetworkAccess right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServicePublicNetworkAccess(string value) => new ContainerServicePublicNetworkAccess(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServicePublicNetworkAccess other && Equals(other); - /// - public bool Equals(ContainerServicePublicNetworkAccess 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/ContainerServiceStateCode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceStateCode.cs deleted file mode 100644 index f0c6de75213f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceStateCode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Tells whether the cluster is Running or Stopped. - public readonly partial struct ContainerServiceStateCode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceStateCode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string RunningValue = "Running"; - private const string StoppedValue = "Stopped"; - - /// The cluster is running. - public static ContainerServiceStateCode Running { get; } = new ContainerServiceStateCode(RunningValue); - /// The cluster is stopped. - public static ContainerServiceStateCode Stopped { get; } = new ContainerServiceStateCode(StoppedValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceStateCode left, ContainerServiceStateCode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceStateCode left, ContainerServiceStateCode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceStateCode(string value) => new ContainerServiceStateCode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceStateCode other && Equals(other); - /// - public bool Equals(ContainerServiceStateCode 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/ContainerServiceTimeInWeek.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs deleted file mode 100644 index 23a3b7c194b9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.Serialization.cs +++ /dev/null @@ -1,215 +0,0 @@ -// 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 ContainerServiceTimeInWeek : 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(ContainerServiceTimeInWeek)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Day)) - { - writer.WritePropertyName("day"u8); - writer.WriteStringValue(Day.Value.ToString()); - } - if (Optional.IsCollectionDefined(HourSlots)) - { - writer.WritePropertyName("hourSlots"u8); - writer.WriteStartArray(); - foreach (var item in HourSlots) - { - writer.WriteNumberValue(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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceTimeInWeek 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(ContainerServiceTimeInWeek)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTimeInWeek(document.RootElement, options); - } - - internal static ContainerServiceTimeInWeek DeserializeContainerServiceTimeInWeek(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ContainerServiceWeekDay? day = default; - IList hourSlots = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("day"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - day = new ContainerServiceWeekDay(property.Value.GetString()); - continue; - } - if (property.NameEquals("hourSlots"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetInt32()); - } - hourSlots = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTimeInWeek(day, hourSlots ?? 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(Day), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" day: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Day)) - { - builder.Append(" day: "); - builder.AppendLine($"'{Day.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HourSlots), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hourSlots: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(HourSlots)) - { - if (HourSlots.Any()) - { - builder.Append(" hourSlots: "); - builder.AppendLine("["); - foreach (var item in HourSlots) - { - 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(ContainerServiceTimeInWeek)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceTimeInWeek 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); - return DeserializeContainerServiceTimeInWeek(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceTimeInWeek)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs deleted file mode 100644 index dbc0a2ae5619..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeInWeek.cs +++ /dev/null @@ -1,72 +0,0 @@ -// 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 -{ - /// Time in a week. - public partial class ContainerServiceTimeInWeek - { - /// - /// 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 ContainerServiceTimeInWeek() - { - HourSlots = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The day of the week. - /// Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceTimeInWeek(ContainerServiceWeekDay? day, IList hourSlots, IDictionary serializedAdditionalRawData) - { - Day = day; - HourSlots = hourSlots; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The day of the week. - [WirePath("day")] - public ContainerServiceWeekDay? Day { get; set; } - /// Each integer hour represents a time range beginning at 0m after the hour ending at the next hour (non-inclusive). 0 corresponds to 00:00 UTC, 23 corresponds to 23:00 UTC. Specifying [0, 1] means the 00:00 - 02:00 UTC time range. - [WirePath("hourSlots")] - public IList HourSlots { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingProvisioningState.cs deleted file mode 100644 index ffef06c2631d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleBindingProvisioningState.cs +++ /dev/null @@ -1,60 +0,0 @@ -// 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 trusted access role binding. - public readonly partial struct ContainerServiceTrustedAccessRoleBindingProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceTrustedAccessRoleBindingProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CanceledValue = "Canceled"; - private const string DeletingValue = "Deleting"; - private const string FailedValue = "Failed"; - private const string SucceededValue = "Succeeded"; - private const string UpdatingValue = "Updating"; - - /// Canceled. - public static ContainerServiceTrustedAccessRoleBindingProvisioningState Canceled { get; } = new ContainerServiceTrustedAccessRoleBindingProvisioningState(CanceledValue); - /// Deleting. - public static ContainerServiceTrustedAccessRoleBindingProvisioningState Deleting { get; } = new ContainerServiceTrustedAccessRoleBindingProvisioningState(DeletingValue); - /// Failed. - public static ContainerServiceTrustedAccessRoleBindingProvisioningState Failed { get; } = new ContainerServiceTrustedAccessRoleBindingProvisioningState(FailedValue); - /// Succeeded. - public static ContainerServiceTrustedAccessRoleBindingProvisioningState Succeeded { get; } = new ContainerServiceTrustedAccessRoleBindingProvisioningState(SucceededValue); - /// Updating. - public static ContainerServiceTrustedAccessRoleBindingProvisioningState Updating { get; } = new ContainerServiceTrustedAccessRoleBindingProvisioningState(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceTrustedAccessRoleBindingProvisioningState left, ContainerServiceTrustedAccessRoleBindingProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceTrustedAccessRoleBindingProvisioningState left, ContainerServiceTrustedAccessRoleBindingProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceTrustedAccessRoleBindingProvisioningState(string value) => new ContainerServiceTrustedAccessRoleBindingProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceTrustedAccessRoleBindingProvisioningState other && Equals(other); - /// - public bool Equals(ContainerServiceTrustedAccessRoleBindingProvisioningState 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/ContainerServiceTrustedAccessRoleRule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs deleted file mode 100644 index 0353e6220aad..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.Serialization.cs +++ /dev/null @@ -1,448 +0,0 @@ -// 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 ContainerServiceTrustedAccessRoleRule : 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(ContainerServiceTrustedAccessRoleRule)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsCollectionDefined(Verbs)) - { - writer.WritePropertyName("verbs"u8); - writer.WriteStartArray(); - foreach (var item in Verbs) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ApiGroups)) - { - writer.WritePropertyName("apiGroups"u8); - writer.WriteStartArray(); - foreach (var item in ApiGroups) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(Resources)) - { - writer.WritePropertyName("resources"u8); - writer.WriteStartArray(); - foreach (var item in Resources) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(ResourceNames)) - { - writer.WritePropertyName("resourceNames"u8); - writer.WriteStartArray(); - foreach (var item in ResourceNames) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (options.Format != "W" && Optional.IsCollectionDefined(NonResourceUrls)) - { - writer.WritePropertyName("nonResourceURLs"u8); - writer.WriteStartArray(); - foreach (var item in NonResourceUrls) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceTrustedAccessRoleRule 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(ContainerServiceTrustedAccessRoleRule)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTrustedAccessRoleRule(document.RootElement, options); - } - - internal static ContainerServiceTrustedAccessRoleRule DeserializeContainerServiceTrustedAccessRoleRule(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList verbs = default; - IReadOnlyList apiGroups = default; - IReadOnlyList resources = default; - IReadOnlyList resourceNames = default; - IReadOnlyList nonResourceUrls = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("verbs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - verbs = array; - continue; - } - if (property.NameEquals("apiGroups"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - apiGroups = array; - continue; - } - if (property.NameEquals("resources"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - resources = array; - continue; - } - if (property.NameEquals("resourceNames"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - resourceNames = array; - continue; - } - if (property.NameEquals("nonResourceURLs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - nonResourceUrls = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTrustedAccessRoleRule( - verbs ?? new ChangeTrackingList(), - apiGroups ?? new ChangeTrackingList(), - resources ?? new ChangeTrackingList(), - resourceNames ?? new ChangeTrackingList(), - nonResourceUrls ?? 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(Verbs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" verbs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Verbs)) - { - if (Verbs.Any()) - { - builder.Append(" verbs: "); - builder.AppendLine("["); - foreach (var item in Verbs) - { - 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(ApiGroups), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" apiGroups: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ApiGroups)) - { - if (ApiGroups.Any()) - { - builder.Append(" apiGroups: "); - builder.AppendLine("["); - foreach (var item in ApiGroups) - { - 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(Resources), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" resources: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Resources)) - { - if (Resources.Any()) - { - builder.Append(" resources: "); - builder.AppendLine("["); - foreach (var item in Resources) - { - 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(ResourceNames), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" resourceNames: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(ResourceNames)) - { - if (ResourceNames.Any()) - { - builder.Append(" resourceNames: "); - builder.AppendLine("["); - foreach (var item in ResourceNames) - { - 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(NonResourceUrls), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nonResourceURLs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NonResourceUrls)) - { - if (NonResourceUrls.Any()) - { - builder.Append(" nonResourceURLs: "); - builder.AppendLine("["); - foreach (var item in NonResourceUrls) - { - 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(ContainerServiceTrustedAccessRoleRule)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceTrustedAccessRoleRule 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); - return DeserializeContainerServiceTrustedAccessRoleRule(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRoleRule)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs deleted file mode 100644 index 2e83084d5863..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRoleRule.cs +++ /dev/null @@ -1,91 +0,0 @@ -// 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 -{ - /// Rule for trusted access role. - public partial class ContainerServiceTrustedAccessRoleRule - { - /// - /// 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 ContainerServiceTrustedAccessRoleRule() - { - Verbs = new ChangeTrackingList(); - ApiGroups = new ChangeTrackingList(); - Resources = new ChangeTrackingList(); - ResourceNames = new ChangeTrackingList(); - NonResourceUrls = new ChangeTrackingList(); - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceTrustedAccessRoleRule(IReadOnlyList verbs, IReadOnlyList apiGroups, IReadOnlyList resources, IReadOnlyList resourceNames, IReadOnlyList nonResourceUrls, IDictionary serializedAdditionalRawData) - { - Verbs = verbs; - ApiGroups = apiGroups; - Resources = resources; - ResourceNames = resourceNames; - NonResourceUrls = nonResourceUrls; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// List of allowed verbs. - [WirePath("verbs")] - public IReadOnlyList Verbs { get; } - /// List of allowed apiGroups. - [WirePath("apiGroups")] - public IReadOnlyList ApiGroups { get; } - /// List of allowed resources. - [WirePath("resources")] - public IReadOnlyList Resources { get; } - /// List of allowed names. - [WirePath("resourceNames")] - public IReadOnlyList ResourceNames { get; } - /// List of allowed nonResourceURLs. - [WirePath("nonResourceURLs")] - public IReadOnlyList NonResourceUrls { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs deleted file mode 100644 index 728ce4c1cd05..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.Serialization.cs +++ /dev/null @@ -1,226 +0,0 @@ -// 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 ContainerServiceUserAssignedIdentity : 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(ContainerServiceUserAssignedIdentity)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ResourceId)) - { - writer.WritePropertyName("resourceId"u8); - writer.WriteStringValue(ResourceId); - } - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId.Value); - } - if (Optional.IsDefined(ObjectId)) - { - writer.WritePropertyName("objectId"u8); - writer.WriteStringValue(ObjectId.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ContainerServiceUserAssignedIdentity 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(ContainerServiceUserAssignedIdentity)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceUserAssignedIdentity(document.RootElement, options); - } - - internal static ContainerServiceUserAssignedIdentity DeserializeContainerServiceUserAssignedIdentity(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier resourceId = default; - Guid? clientId = default; - Guid? objectId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("clientId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clientId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("objectId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - objectId = property.Value.GetGuid(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceUserAssignedIdentity(resourceId, clientId, objectId, 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(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(ClientId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" clientId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ClientId)) - { - builder.Append(" clientId: "); - builder.AppendLine($"'{ClientId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" objectId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ObjectId)) - { - builder.Append(" objectId: "); - builder.AppendLine($"'{ObjectId.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(ContainerServiceUserAssignedIdentity)} does not support writing '{options.Format}' format."); - } - } - - ContainerServiceUserAssignedIdentity 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); - return DeserializeContainerServiceUserAssignedIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ContainerServiceUserAssignedIdentity)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs deleted file mode 100644 index e2173bf9823c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceUserAssignedIdentity.cs +++ /dev/null @@ -1,77 +0,0 @@ -// 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 -{ - /// Details about a user assigned identity. - public partial class ContainerServiceUserAssignedIdentity - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public ContainerServiceUserAssignedIdentity() - { - } - - /// Initializes a new instance of . - /// The resource ID of the user assigned identity. - /// The client ID of the user assigned identity. - /// The object ID of the user assigned identity. - /// Keeps track of any properties unknown to the library. - internal ContainerServiceUserAssignedIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId, IDictionary serializedAdditionalRawData) - { - ResourceId = resourceId; - ClientId = clientId; - ObjectId = objectId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The resource ID of the user assigned identity. - [WirePath("resourceId")] - public ResourceIdentifier ResourceId { get; set; } - /// The client ID of the user assigned identity. - [WirePath("clientId")] - public Guid? ClientId { get; set; } - /// The object ID of the user assigned identity. - [WirePath("objectId")] - public Guid? ObjectId { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceWeekDay.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceWeekDay.cs deleted file mode 100644 index a5182acac70d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceWeekDay.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 weekday enum. - public readonly partial struct ContainerServiceWeekDay : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ContainerServiceWeekDay(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SundayValue = "Sunday"; - private const string MondayValue = "Monday"; - private const string TuesdayValue = "Tuesday"; - private const string WednesdayValue = "Wednesday"; - private const string ThursdayValue = "Thursday"; - private const string FridayValue = "Friday"; - private const string SaturdayValue = "Saturday"; - - /// Sunday. - public static ContainerServiceWeekDay Sunday { get; } = new ContainerServiceWeekDay(SundayValue); - /// Monday. - public static ContainerServiceWeekDay Monday { get; } = new ContainerServiceWeekDay(MondayValue); - /// Tuesday. - public static ContainerServiceWeekDay Tuesday { get; } = new ContainerServiceWeekDay(TuesdayValue); - /// Wednesday. - public static ContainerServiceWeekDay Wednesday { get; } = new ContainerServiceWeekDay(WednesdayValue); - /// Thursday. - public static ContainerServiceWeekDay Thursday { get; } = new ContainerServiceWeekDay(ThursdayValue); - /// Friday. - public static ContainerServiceWeekDay Friday { get; } = new ContainerServiceWeekDay(FridayValue); - /// Saturday. - public static ContainerServiceWeekDay Saturday { get; } = new ContainerServiceWeekDay(SaturdayValue); - /// Determines if two values are the same. - public static bool operator ==(ContainerServiceWeekDay left, ContainerServiceWeekDay right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ContainerServiceWeekDay left, ContainerServiceWeekDay right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ContainerServiceWeekDay(string value) => new ContainerServiceWeekDay(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ContainerServiceWeekDay other && Equals(other); - /// - public bool Equals(ContainerServiceWeekDay 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/DailySchedule.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs deleted file mode 100644 index ea78c9128dd7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -{ - /// For schedules like: 'recur every day' or 'recur every 3 days'. - internal partial class DailySchedule - { - /// - /// 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 . - /// Specifies the number of days between each set of occurrences. - public DailySchedule(int intervalDays) - { - IntervalDays = intervalDays; - } - - /// Initializes a new instance of . - /// Specifies the number of days between each set of occurrences. - /// Keeps track of any properties unknown to the library. - internal DailySchedule(int intervalDays, IDictionary serializedAdditionalRawData) - { - IntervalDays = intervalDays; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal DailySchedule() - { - } - - /// Specifies the number of days between each set of occurrences. - [WirePath("intervalDays")] - public int IntervalDays { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.Serialization.cs similarity index 75% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.Serialization.cs index 11f25646a45e..42f93e2bf0c8 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterCredential : IUtf8JsonSerializable, IJsonModel + public partial class FleetCredentialResult : 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,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(ManagedClusterCredential)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResult)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsDefined(Name)) @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterCredential IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetCredentialResult 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(ManagedClusterCredential)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterCredential(document.RootElement, options); + return DeserializeFleetCredentialResult(document.RootElement, options); } - internal static ManagedClusterCredential DeserializeManagedClusterCredential(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetCredentialResult DeserializeFleetCredentialResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -108,7 +108,7 @@ internal static ManagedClusterCredential DeserializeManagedClusterCredential(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterCredential(name, value, serializedAdditionalRawData); + return new FleetCredentialResult(name, value, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -164,9 +164,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -175,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterCredential)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResult)} does not support writing '{options.Format}' format."); } } - ManagedClusterCredential IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetCredentialResult 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); - return DeserializeManagedClusterCredential(document.RootElement, options); + return DeserializeFleetCredentialResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterCredential)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResult)} 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/ManagedClusterCredential.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.cs similarity index 82% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.cs index 335b0dcaa551..dd59f9e0ca2c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredential.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResult.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The credential result response. - public partial class ManagedClusterCredential + /// One credential result item. + public partial class FleetCredentialResult { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class ManagedClusterCredential /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ManagedClusterCredential() + /// Initializes a new instance of . + internal FleetCredentialResult() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The name of the credential. /// Base64-encoded Kubernetes configuration file. /// Keeps track of any properties unknown to the library. - internal ManagedClusterCredential(string name, byte[] value, IDictionary serializedAdditionalRawData) + internal FleetCredentialResult(string name, byte[] value, IDictionary serializedAdditionalRawData) { Name = name; Value = value; diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.Serialization.cs similarity index 70% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.Serialization.cs index 9eb821e0a8ca..44146be8d1df 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterCredentials : IUtf8JsonSerializable, IJsonModel + public partial class FleetCredentialResults : 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); @@ -30,10 +30,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(ManagedClusterCredentials)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResults)} does not support writing '{format}' format."); } if (options.Format != "W" && Optional.IsCollectionDefined(Kubeconfigs)) @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetCredentialResults 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(ManagedClusterCredentials)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResults)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterCredentials(document.RootElement, options); + return DeserializeFleetCredentialResults(document.RootElement, options); } - internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetCredentialResults DeserializeFleetCredentialResults(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,7 +83,7 @@ internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(J { return null; } - IReadOnlyList kubeconfigs = default; + IReadOnlyList kubeconfigs = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -94,10 +94,10 @@ internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(J { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ManagedClusterCredential.DeserializeManagedClusterCredential(item, options)); + array.Add(FleetCredentialResult.DeserializeFleetCredentialResult(item, options)); } kubeconfigs = array; continue; @@ -108,7 +108,7 @@ internal static ManagedClusterCredentials DeserializeManagedClusterCredentials(J } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterCredentials(kubeconfigs ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new FleetCredentialResults(kubeconfigs ?? new ChangeTrackingList(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -149,9 +149,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -160,26 +160,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterCredentials)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResults)} does not support writing '{options.Format}' format."); } } - ManagedClusterCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetCredentialResults 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); - return DeserializeManagedClusterCredentials(document.RootElement, options); + return DeserializeFleetCredentialResults(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterCredentials)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetCredentialResults)} 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/ManagedClusterCredentials.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.cs similarity index 69% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.cs index 410770e42672..de4e198fc35a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterCredentials.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetCredentialResults.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The list credential result response. - public partial class ManagedClusterCredentials + /// The Credential results response. + public partial class FleetCredentialResults { /// /// Keeps track of any properties unknown to the library. @@ -45,23 +45,23 @@ public partial class ManagedClusterCredentials /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ManagedClusterCredentials() + /// Initializes a new instance of . + internal FleetCredentialResults() { - Kubeconfigs = new ChangeTrackingList(); + Kubeconfigs = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Base64-encoded Kubernetes configuration file. + /// Initializes a new instance of . + /// Array of base64-encoded Kubernetes configuration files. /// Keeps track of any properties unknown to the library. - internal ManagedClusterCredentials(IReadOnlyList kubeconfigs, IDictionary serializedAdditionalRawData) + internal FleetCredentialResults(IReadOnlyList kubeconfigs, IDictionary serializedAdditionalRawData) { Kubeconfigs = kubeconfigs; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Base64-encoded Kubernetes configuration file. + /// Array of base64-encoded Kubernetes configuration files. [WirePath("kubeconfigs")] - public IReadOnlyList Kubeconfigs { get; } + public IReadOnlyList Kubeconfigs { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.Serialization.cs new file mode 100644 index 000000000000..f7031e321906 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.Serialization.cs @@ -0,0 +1,339 @@ +// 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 FleetHubProfile : 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(FleetHubProfile)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DnsPrefix)) + { + writer.WritePropertyName("dnsPrefix"u8); + writer.WriteStringValue(DnsPrefix); + } + if (Optional.IsDefined(ApiServerAccessProfile)) + { + writer.WritePropertyName("apiServerAccessProfile"u8); + writer.WriteObjectValue(ApiServerAccessProfile, options); + } + if (Optional.IsDefined(AgentProfile)) + { + writer.WritePropertyName("agentProfile"u8); + writer.WriteObjectValue(AgentProfile, options); + } + if (options.Format != "W" && Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (options.Format != "W" && Optional.IsDefined(KubernetesVersion)) + { + writer.WritePropertyName("kubernetesVersion"u8); + writer.WriteStringValue(KubernetesVersion); + } + if (options.Format != "W" && Optional.IsDefined(PortalFqdn)) + { + writer.WritePropertyName("portalFqdn"u8); + writer.WriteStringValue(PortalFqdn); + } + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FleetHubProfile 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(FleetHubProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFleetHubProfile(document.RootElement, options); + } + + internal static FleetHubProfile DeserializeFleetHubProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string dnsPrefix = default; + ApiServerAccessProfile apiServerAccessProfile = default; + AgentProfile agentProfile = default; + string fqdn = default; + string kubernetesVersion = default; + string portalFqdn = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dnsPrefix"u8)) + { + dnsPrefix = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiServerAccessProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiServerAccessProfile = ApiServerAccessProfile.DeserializeApiServerAccessProfile(property.Value, options); + continue; + } + if (property.NameEquals("agentProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + agentProfile = AgentProfile.DeserializeAgentProfile(property.Value, options); + continue; + } + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesVersion"u8)) + { + kubernetesVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("portalFqdn"u8)) + { + portalFqdn = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FleetHubProfile( + dnsPrefix, + apiServerAccessProfile, + agentProfile, + fqdn, + kubernetesVersion, + portalFqdn, + 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(DnsPrefix), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsPrefix: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsPrefix)) + { + builder.Append(" dnsPrefix: "); + if (DnsPrefix.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DnsPrefix}'''"); + } + else + { + builder.AppendLine($"'{DnsPrefix}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiServerAccessProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiServerAccessProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ApiServerAccessProfile)) + { + builder.Append(" apiServerAccessProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, ApiServerAccessProfile, options, 2, false, " apiServerAccessProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentProfile), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" agentProfile: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AgentProfile)) + { + builder.Append(" agentProfile: "); + BicepSerializationHelpers.AppendChildObject(builder, AgentProfile, options, 2, false, " agentProfile: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Fqdn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" fqdn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Fqdn)) + { + builder.Append(" fqdn: "); + if (Fqdn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Fqdn}'''"); + } + else + { + builder.AppendLine($"'{Fqdn}'"); + } + } + } + + 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(PortalFqdn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" portalFqdn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PortalFqdn)) + { + builder.Append(" portalFqdn: "); + if (PortalFqdn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PortalFqdn}'''"); + } + else + { + builder.AppendLine($"'{PortalFqdn}'"); + } + } + } + + 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(FleetHubProfile)} does not support writing '{options.Format}' format."); + } + } + + FleetHubProfile 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); + return DeserializeFleetHubProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FleetHubProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.cs new file mode 100644 index 000000000000..660de34dbb5b --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetHubProfile.cs @@ -0,0 +1,91 @@ +// 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 FleetHubProfile configures the fleet hub. + public partial class FleetHubProfile + { + /// + /// 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 FleetHubProfile() + { + } + + /// Initializes a new instance of . + /// DNS prefix used to create the FQDN for the Fleet hub. + /// The access profile for the Fleet hub API server. + /// The agent profile for the Fleet hub. + /// The FQDN of the Fleet hub. + /// The Kubernetes version of the Fleet hub. + /// The Azure Portal FQDN of the Fleet hub. + /// Keeps track of any properties unknown to the library. + internal FleetHubProfile(string dnsPrefix, ApiServerAccessProfile apiServerAccessProfile, AgentProfile agentProfile, string fqdn, string kubernetesVersion, string portalFqdn, IDictionary serializedAdditionalRawData) + { + DnsPrefix = dnsPrefix; + ApiServerAccessProfile = apiServerAccessProfile; + AgentProfile = agentProfile; + Fqdn = fqdn; + KubernetesVersion = kubernetesVersion; + PortalFqdn = portalFqdn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// DNS prefix used to create the FQDN for the Fleet hub. + [WirePath("dnsPrefix")] + public string DnsPrefix { get; set; } + /// The access profile for the Fleet hub API server. + [WirePath("apiServerAccessProfile")] + public ApiServerAccessProfile ApiServerAccessProfile { get; set; } + /// The agent profile for the Fleet hub. + [WirePath("agentProfile")] + public AgentProfile AgentProfile { get; set; } + /// The FQDN of the Fleet hub. + [WirePath("fqdn")] + public string Fqdn { get; } + /// The Kubernetes version of the Fleet hub. + [WirePath("kubernetesVersion")] + public string KubernetesVersion { get; } + /// The Azure Portal FQDN of the Fleet hub. + [WirePath("portalFqdn")] + public string PortalFqdn { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileList.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs similarity index 65% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileList.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs index b75a48a85cd3..44ed09168e14 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileList.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class MeshUpgradeProfileList : IUtf8JsonSerializable, IJsonModel + internal partial class FleetListResult : 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); @@ -30,26 +30,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader /// 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(MeshUpgradeProfileList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -68,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MeshUpgradeProfileList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetListResult 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(MeshUpgradeProfileList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshUpgradeProfileList(document.RootElement, options); + return DeserializeFleetListResult(document.RootElement, options); } - internal static MeshUpgradeProfileList DeserializeMeshUpgradeProfileList(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetListResult DeserializeFleetListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,29 +85,29 @@ internal static MeshUpgradeProfileList DeserializeMeshUpgradeProfileList(JsonEle { return null; } - IReadOnlyList value = default; - string nextLink = default; + 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(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(MeshUpgradeProfileData.DeserializeMeshUpgradeProfileData(item, options)); + array.Add(FleetData.DeserializeFleetData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static MeshUpgradeProfileList DeserializeMeshUpgradeProfileList(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new MeshUpgradeProfileList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new FleetListResult(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } @@ -183,9 +172,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -194,26 +183,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(MeshUpgradeProfileList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetListResult)} does not support writing '{options.Format}' format."); } } - MeshUpgradeProfileList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetListResult 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); - return DeserializeMeshUpgradeProfileList(document.RootElement, options); + return DeserializeFleetListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MeshUpgradeProfileList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetListResult)} 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/MeshUpgradeProfileList.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileList.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs index b24c747b783d..81c272762800 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileList.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetListResult.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// Holds an array of MeshUpgradeProfiles. - internal partial class MeshUpgradeProfileList + /// The response of a Fleet list operation. + internal partial class FleetListResult { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,35 @@ internal partial class MeshUpgradeProfileList /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal MeshUpgradeProfileList() + /// Initializes a new instance of . + /// The Fleet items on this page. + /// is null. + internal FleetListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// Array of supported service mesh add-on upgrade profiles. - /// The URL to get the next set of mesh upgrade profile. + /// Initializes a new instance of . + /// The Fleet items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal MeshUpgradeProfileList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal FleetListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of supported service mesh add-on upgrade profiles. - public IReadOnlyList Value { get; } - /// The URL to get the next set of mesh upgrade profile. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal FleetListResult() + { + } + + /// The Fleet items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.Serialization.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.Serialization.cs index 143eed16970a..a9cc0ff194a9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/AgentPoolSnapshotListResult.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class AgentPoolSnapshotListResult : IUtf8JsonSerializable, IJsonModel + internal partial class FleetMemberListResult : 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); @@ -30,26 +30,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR /// 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(AgentPoolSnapshotListResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -68,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AgentPoolSnapshotListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetMemberListResult 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(AgentPoolSnapshotListResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAgentPoolSnapshotListResult(document.RootElement, options); + return DeserializeFleetMemberListResult(document.RootElement, options); } - internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetMemberListResult DeserializeFleetMemberListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,29 +85,29 @@ internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResu { return null; } - IReadOnlyList value = default; - string nextLink = default; + 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(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(item, options)); + array.Add(FleetMemberData.DeserializeFleetMemberData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static AgentPoolSnapshotListResult DeserializeAgentPoolSnapshotListResu } } serializedAdditionalRawData = rawDataDictionary; - return new AgentPoolSnapshotListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new FleetMemberListResult(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } @@ -183,9 +172,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -194,26 +183,26 @@ BinaryData IPersistableModel.Write(ModelReaderWrite case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(AgentPoolSnapshotListResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberListResult)} does not support writing '{options.Format}' format."); } } - AgentPoolSnapshotListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetMemberListResult 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); - return DeserializeAgentPoolSnapshotListResult(document.RootElement, options); + return DeserializeFleetMemberListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AgentPoolSnapshotListResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberListResult)} 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/TrustedAccessRoleBindingListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.cs similarity index 57% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.cs index 1539915c877f..497cfce88604 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberListResult.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// List of trusted access role bindings. - internal partial class TrustedAccessRoleBindingListResult + /// The response of a FleetMember list operation. + internal partial class FleetMemberListResult { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,35 @@ internal partial class TrustedAccessRoleBindingListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal TrustedAccessRoleBindingListResult() + /// Initializes a new instance of . + /// The FleetMember items on this page. + /// is null. + internal FleetMemberListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// Role binding list. - /// Link to next page of resources. + /// Initializes a new instance of . + /// The FleetMember items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal TrustedAccessRoleBindingListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal FleetMemberListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Role binding list. - public IReadOnlyList Value { get; } - /// Link to next page of resources. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal FleetMemberListResult() + { + } + + /// The FleetMember items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.Serialization.cs new file mode 100644 index 000000000000..af2d2171c980 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.Serialization.cs @@ -0,0 +1,170 @@ +// 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 FleetMemberPatch : 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(FleetMemberPatch)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Group)) + { + writer.WritePropertyName("group"u8); + writer.WriteStringValue(Group); + } + 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(); + } + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FleetMemberPatch 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(FleetMemberPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFleetMemberPatch(document.RootElement, options); + } + + internal static FleetMemberPatch DeserializeFleetMemberPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string group = default; + IDictionary labels = 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) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("group"u8)) + { + group = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("labels"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary.Add(property1.Name, property1.Value.GetString()); + } + labels = dictionary; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FleetMemberPatch(group, labels ?? new ChangeTrackingDictionary(), 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(FleetMemberPatch)} does not support writing '{options.Format}' format."); + } + } + + FleetMemberPatch 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); + return DeserializeFleetMemberPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FleetMemberPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.cs index fcfa7101fb37..fc3d519b9b1b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateEndpointConnectionListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberPatch.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// A list of private endpoint connections. - internal partial class ContainerServicePrivateEndpointConnectionListResult + /// The type used for update operations of the FleetMember. + public partial class FleetMemberPatch { /// /// Keeps track of any properties unknown to the library. @@ -45,23 +45,28 @@ internal partial class ContainerServicePrivateEndpointConnectionListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ContainerServicePrivateEndpointConnectionListResult() + /// Initializes a new instance of . + public FleetMemberPatch() { - Value = new ChangeTrackingList(); + Labels = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . - /// The collection value. + /// Initializes a new instance of . + /// The group this member belongs to for multi-cluster update management. + /// The labels for the fleet member. /// Keeps track of any properties unknown to the library. - internal ContainerServicePrivateEndpointConnectionListResult(IReadOnlyList value, IDictionary serializedAdditionalRawData) + internal FleetMemberPatch(string group, IDictionary labels, IDictionary serializedAdditionalRawData) { - Value = value; + Group = group; + Labels = labels; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The collection value. - [WirePath("value")] - public IReadOnlyList Value { get; } + /// The group this member belongs to for multi-cluster update management. + [WirePath("properties.group")] + public string Group { get; set; } + /// The labels for the fleet member. + [WirePath("properties.labels")] + public IDictionary Labels { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberProvisioningState.cs new file mode 100644 index 000000000000..fcefa0a1c132 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberProvisioningState.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 provisioning state of the last accepted operation. + public readonly partial struct FleetMemberProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetMemberProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string JoiningValue = "Joining"; + private const string LeavingValue = "Leaving"; + private const string UpdatingValue = "Updating"; + + /// Resource has been created. + public static FleetMemberProvisioningState Succeeded { get; } = new FleetMemberProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetMemberProvisioningState Failed { get; } = new FleetMemberProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetMemberProvisioningState Canceled { get; } = new FleetMemberProvisioningState(CanceledValue); + /// The provisioning state of a member joining a fleet. + public static FleetMemberProvisioningState Joining { get; } = new FleetMemberProvisioningState(JoiningValue); + /// The provisioning state of a member leaving a fleet. + public static FleetMemberProvisioningState Leaving { get; } = new FleetMemberProvisioningState(LeavingValue); + /// The provisioning state of a member being updated. + public static FleetMemberProvisioningState Updating { get; } = new FleetMemberProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(FleetMemberProvisioningState left, FleetMemberProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetMemberProvisioningState left, FleetMemberProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FleetMemberProvisioningState(string value) => new FleetMemberProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetMemberProvisioningState other && Equals(other); + /// + public bool Equals(FleetMemberProvisioningState 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/ManagedClusterSku.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.Serialization.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.Serialization.cs index 4b62f7cfe76d..dbb3a45fd12c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterSku : IUtf8JsonSerializable, IJsonModel + public partial class FleetMemberStatus : 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,21 +29,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite /// 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(ManagedClusterSku)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) + if (options.Format != "W" && Optional.IsDefined(LastOperationId)) { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name.Value.ToString()); + writer.WritePropertyName("lastOperationId"u8); + writer.WriteStringValue(LastOperationId); } - if (Optional.IsDefined(Tier)) + if (options.Format != "W" && Optional.IsDefined(LastOperationError)) { - writer.WritePropertyName("tier"u8); - writer.WriteStringValue(Tier.Value.ToString()); + writer.WritePropertyName("lastOperationError"u8); + JsonSerializer.Serialize(writer, LastOperationError); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetMemberStatus 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(ManagedClusterSku)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetMemberStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSku(document.RootElement, options); + return DeserializeFleetMemberStatus(document.RootElement, options); } - internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetMemberStatus DeserializeFleetMemberStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -82,28 +82,24 @@ internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement eleme { return null; } - ManagedClusterSkuName? name = default; - ManagedClusterSkuTier? tier = default; + string lastOperationId = default; + ResponseError lastOperationError = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) + if (property.NameEquals("lastOperationId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - name = new ManagedClusterSkuName(property.Value.GetString()); + lastOperationId = property.Value.GetString(); continue; } - if (property.NameEquals("tier"u8)) + if (property.NameEquals("lastOperationError"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - tier = new ManagedClusterSkuTier(property.Value.GetString()); + lastOperationError = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (options.Format != "W") @@ -112,7 +108,7 @@ internal static ManagedClusterSku DeserializeManagedClusterSku(JsonElement eleme } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSku(name, tier, serializedAdditionalRawData); + return new FleetMemberStatus(lastOperationId, lastOperationError, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -126,33 +122,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastOperationId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" name: "); + builder.Append(" lastOperationId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Name)) + if (Optional.IsDefined(LastOperationId)) { - builder.Append(" name: "); - builder.AppendLine($"'{Name.Value.ToString()}'"); + builder.Append(" lastOperationId: "); + if (LastOperationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastOperationId}'''"); + } + else + { + builder.AppendLine($"'{LastOperationId}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tier), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastOperationError), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" tier: "); + builder.Append(" lastOperationError: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Tier)) + if (Optional.IsDefined(LastOperationError)) { - builder.Append(" tier: "); - builder.AppendLine($"'{Tier.Value.ToString()}'"); + builder.Append(" lastOperationError: "); + BicepSerializationHelpers.AppendChildObject(builder, LastOperationError, options, 2, false, " lastOperationError: "); } } @@ -160,9 +164,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -171,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions o case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterSku)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberStatus)} does not support writing '{options.Format}' format."); } } - ManagedClusterSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetMemberStatus 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); - return DeserializeManagedClusterSku(document.RootElement, options); + return DeserializeFleetMemberStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterSku)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetMemberStatus)} 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/ManagedClusterOidcIssuerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.cs similarity index 62% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.cs index fb34222e280f..7cb19067e1ba 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetMemberStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The OIDC issuer profile of the Managed Cluster. - public partial class ManagedClusterOidcIssuerProfile + /// Status information for the fleet member. + public partial class FleetMemberStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,27 @@ public partial class ManagedClusterOidcIssuerProfile /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ManagedClusterOidcIssuerProfile() + /// Initializes a new instance of . + internal FleetMemberStatus() { } - /// Initializes a new instance of . - /// The OIDC issuer url of the Managed Cluster. - /// Whether the OIDC issuer is enabled. + /// Initializes a new instance of . + /// The last operation ID for the fleet member. + /// The last operation error of the fleet member. /// Keeps track of any properties unknown to the library. - internal ManagedClusterOidcIssuerProfile(string issuerUriInfo, bool? isEnabled, IDictionary serializedAdditionalRawData) + internal FleetMemberStatus(string lastOperationId, ResponseError lastOperationError, IDictionary serializedAdditionalRawData) { - IssuerUriInfo = issuerUriInfo; - IsEnabled = isEnabled; + LastOperationId = lastOperationId; + LastOperationError = lastOperationError; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The OIDC issuer url of the Managed Cluster. - [WirePath("issuerURL")] - public string IssuerUriInfo { get; } - /// Whether the OIDC issuer is enabled. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } + /// The last operation ID for the fleet member. + [WirePath("lastOperationId")] + public string LastOperationId { get; } + /// The last operation error of the fleet member. + [WirePath("lastOperationError")] + public ResponseError LastOperationError { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.Serialization.cs similarity index 63% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.Serialization.cs index b35458d4cbd3..6360c3696252 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.Serialization.cs @@ -10,14 +10,15 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTagsObject : IUtf8JsonSerializable, IJsonModel + public partial class FleetPatch : 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); @@ -28,10 +29,10 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe /// 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(ContainerServiceTagsObject)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetPatch)} does not support writing '{format}' format."); } if (Optional.IsCollectionDefined(Tags)) @@ -45,6 +46,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } writer.WriteEndObject(); } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + JsonSerializer.Serialize(writer, Identity); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -62,19 +68,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceTagsObject IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetPatch 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(ContainerServiceTagsObject)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTagsObject(document.RootElement, options); + return DeserializeFleetPatch(document.RootElement, options); } - internal static ContainerServiceTagsObject DeserializeContainerServiceTagsObject(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetPatch DeserializeFleetPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,6 +89,7 @@ internal static ContainerServiceTagsObject DeserializeContainerServiceTagsObject return null; } IDictionary tags = default; + ResourceManager.Models.ManagedServiceIdentity identity = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -101,44 +108,53 @@ internal static ContainerServiceTagsObject DeserializeContainerServiceTagsObject tags = dictionary; continue; } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTagsObject(tags ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + return new FleetPatch(tags ?? new ChangeTrackingDictionary(), identity, serializedAdditionalRawData); } - 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) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ContainerServiceTagsObject)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetPatch)} does not support writing '{options.Format}' format."); } } - ContainerServiceTagsObject IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetPatch 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); - return DeserializeContainerServiceTagsObject(document.RootElement, options); + return DeserializeFleetPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceTagsObject)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetPatch)} 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/ContainerServiceTagsObject.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.cs similarity index 73% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.cs index 220ceed13de7..e5b1ca1d0032 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTagsObject.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetPatch.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.ResourceManager.Models; namespace Azure.ResourceManager.ContainerService.Models { - /// Tags object for patch operations. - public partial class ContainerServiceTagsObject + /// Properties of a Fleet that can be patched. + public partial class FleetPatch { /// /// Keeps track of any properties unknown to the library. @@ -45,23 +46,28 @@ public partial class ContainerServiceTagsObject /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ContainerServiceTagsObject() + /// Initializes a new instance of . + public FleetPatch() { Tags = new ChangeTrackingDictionary(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// Resource tags. + /// Managed identity. /// Keeps track of any properties unknown to the library. - internal ContainerServiceTagsObject(IDictionary tags, IDictionary serializedAdditionalRawData) + internal FleetPatch(IDictionary tags, ResourceManager.Models.ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) { Tags = tags; + Identity = identity; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Resource tags. [WirePath("tags")] public IDictionary Tags { get; } + /// Managed identity. + [WirePath("identity")] + public ResourceManager.Models.ManagedServiceIdentity Identity { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetProvisioningState.cs new file mode 100644 index 000000000000..6294227e99c5 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetProvisioningState.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 provisioning state of the last accepted operation. + public readonly partial struct FleetProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + + /// Resource has been created. + public static FleetProvisioningState Succeeded { get; } = new FleetProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetProvisioningState Failed { get; } = new FleetProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetProvisioningState Canceled { get; } = new FleetProvisioningState(CanceledValue); + /// The provisioning state of a fleet being created. + public static FleetProvisioningState Creating { get; } = new FleetProvisioningState(CreatingValue); + /// The provisioning state of a fleet being updated. + public static FleetProvisioningState Updating { get; } = new FleetProvisioningState(UpdatingValue); + /// The provisioning state of a fleet being deleted. + public static FleetProvisioningState Deleting { get; } = new FleetProvisioningState(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(FleetProvisioningState left, FleetProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetProvisioningState left, FleetProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FleetProvisioningState(string value) => new FleetProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetProvisioningState other && Equals(other); + /// + public bool Equals(FleetProvisioningState 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/UpgradeOverrideSettings.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.Serialization.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeOverrideSettings.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.Serialization.cs index a008718ead02..e582d7428056 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeOverrideSettings.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class UpgradeOverrideSettings : IUtf8JsonSerializable, IJsonModel + public partial class FleetStatus : 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,21 +29,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(UpgradeOverrideSettings)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ForceUpgrade)) + if (options.Format != "W" && Optional.IsDefined(LastOperationId)) { - writer.WritePropertyName("forceUpgrade"u8); - writer.WriteBooleanValue(ForceUpgrade.Value); + writer.WritePropertyName("lastOperationId"u8); + writer.WriteStringValue(LastOperationId); } - if (Optional.IsDefined(Until)) + if (options.Format != "W" && Optional.IsDefined(LastOperationError)) { - writer.WritePropertyName("until"u8); - writer.WriteStringValue(Until.Value, "O"); + writer.WritePropertyName("lastOperationError"u8); + JsonSerializer.Serialize(writer, LastOperationError); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - UpgradeOverrideSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetStatus 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(UpgradeOverrideSettings)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeUpgradeOverrideSettings(document.RootElement, options); + return DeserializeFleetStatus(document.RootElement, options); } - internal static UpgradeOverrideSettings DeserializeUpgradeOverrideSettings(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetStatus DeserializeFleetStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -82,28 +82,24 @@ internal static UpgradeOverrideSettings DeserializeUpgradeOverrideSettings(JsonE { return null; } - bool? forceUpgrade = default; - DateTimeOffset? until = default; + string lastOperationId = default; + ResponseError lastOperationError = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("forceUpgrade"u8)) + if (property.NameEquals("lastOperationId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - forceUpgrade = property.Value.GetBoolean(); + lastOperationId = property.Value.GetString(); continue; } - if (property.NameEquals("until"u8)) + if (property.NameEquals("lastOperationError"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - until = property.Value.GetDateTimeOffset("O"); + lastOperationError = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (options.Format != "W") @@ -112,7 +108,7 @@ internal static UpgradeOverrideSettings DeserializeUpgradeOverrideSettings(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new UpgradeOverrideSettings(forceUpgrade, until, serializedAdditionalRawData); + return new FleetStatus(lastOperationId, lastOperationError, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -126,35 +122,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ForceUpgrade), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastOperationId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" forceUpgrade: "); + builder.Append(" lastOperationId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ForceUpgrade)) + if (Optional.IsDefined(LastOperationId)) { - builder.Append(" forceUpgrade: "); - var boolValue = ForceUpgrade.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); + builder.Append(" lastOperationId: "); + if (LastOperationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastOperationId}'''"); + } + else + { + builder.AppendLine($"'{LastOperationId}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Until), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastOperationError), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" until: "); + builder.Append(" lastOperationError: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Until)) + if (Optional.IsDefined(LastOperationError)) { - builder.Append(" until: "); - var formattedDateTimeString = TypeFormatters.ToString(Until.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); + builder.Append(" lastOperationError: "); + BicepSerializationHelpers.AppendChildObject(builder, LastOperationError, options, 2, false, " lastOperationError: "); } } @@ -162,9 +164,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -173,26 +175,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(UpgradeOverrideSettings)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetStatus)} does not support writing '{options.Format}' format."); } } - UpgradeOverrideSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetStatus 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); - return DeserializeUpgradeOverrideSettings(document.RootElement, options); + return DeserializeFleetStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(UpgradeOverrideSettings)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetStatus)} 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/ManagedClusterPodIdentityProvisioningError.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.cs index 9c2811a1d873..fe829fdce4c0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// An error response from the pod identity provisioning. - internal partial class ManagedClusterPodIdentityProvisioningError + /// Status information for the fleet. + public partial class FleetStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,27 @@ internal partial class ManagedClusterPodIdentityProvisioningError /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ManagedClusterPodIdentityProvisioningError() + /// Initializes a new instance of . + internal FleetStatus() { } - /// Initializes a new instance of . - /// Details about the error. + /// Initializes a new instance of . + /// The last operation ID for the fleet. + /// The last operation error for the fleet. /// Keeps track of any properties unknown to the library. - internal ManagedClusterPodIdentityProvisioningError(ResponseError errorDetail, IDictionary serializedAdditionalRawData) + internal FleetStatus(string lastOperationId, ResponseError lastOperationError, IDictionary serializedAdditionalRawData) { - ErrorDetail = errorDetail; + LastOperationId = lastOperationId; + LastOperationError = lastOperationError; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Details about the error. - [WirePath("error")] - public ResponseError ErrorDetail { get; } + /// The last operation ID for the fleet. + [WirePath("lastOperationId")] + public string LastOperationId { get; } + /// The last operation error for the fleet. + [WirePath("lastOperationError")] + public ResponseError LastOperationError { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.Serialization.cs similarity index 64% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.Serialization.cs index 38dc939c38cc..c5a287820b24 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class MeshRevisionProfileList : IUtf8JsonSerializable, IJsonModel + internal partial class FleetUpdateStrategyListResult : 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); @@ -30,26 +30,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade /// 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(MeshRevisionProfileList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyListResult)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(Value)) + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) { - writer.WritePropertyName("value"u8); - writer.WriteStartArray(); - foreach (var item in Value) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WriteObjectValue(item, options); } - if (options.Format != "W" && Optional.IsDefined(NextLink)) + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -68,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MeshRevisionProfileList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FleetUpdateStrategyListResult 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(MeshRevisionProfileList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyListResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshRevisionProfileList(document.RootElement, options); + return DeserializeFleetUpdateStrategyListResult(document.RootElement, options); } - internal static MeshRevisionProfileList DeserializeMeshRevisionProfileList(JsonElement element, ModelReaderWriterOptions options = null) + internal static FleetUpdateStrategyListResult DeserializeFleetUpdateStrategyListResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,29 +85,29 @@ internal static MeshRevisionProfileList DeserializeMeshRevisionProfileList(JsonE { return null; } - IReadOnlyList value = default; - string nextLink = default; + 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(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(MeshRevisionProfileData.DeserializeMeshRevisionProfileData(item, options)); + array.Add(FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(item, options)); } value = array; continue; } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static MeshRevisionProfileList DeserializeMeshRevisionProfileList(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new MeshRevisionProfileList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new FleetUpdateStrategyListResult(value, nextLink, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -167,15 +164,7 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) if (Optional.IsDefined(NextLink)) { builder.Append(" nextLink: "); - if (NextLink.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NextLink}'''"); - } - else - { - builder.AppendLine($"'{NextLink}'"); - } + builder.AppendLine($"'{NextLink.AbsoluteUri}'"); } } @@ -183,9 +172,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -194,26 +183,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(MeshRevisionProfileList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyListResult)} does not support writing '{options.Format}' format."); } } - MeshRevisionProfileList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FleetUpdateStrategyListResult 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); - return DeserializeMeshRevisionProfileList(document.RootElement, options); + return DeserializeFleetUpdateStrategyListResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MeshRevisionProfileList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FleetUpdateStrategyListResult)} 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/ContainerServiceSshConfiguration.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.cs index b3e4dd9474c5..1568d00f717a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyListResult.cs @@ -11,8 +11,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// SSH configuration for Linux-based VMs running on Azure. - public partial class ContainerServiceSshConfiguration + /// The response of a FleetUpdateStrategy list operation. + internal partial class FleetUpdateStrategyListResult { /// /// Keeps track of any properties unknown to the library. @@ -46,32 +46,35 @@ public partial class ContainerServiceSshConfiguration /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. - /// is null. - public ContainerServiceSshConfiguration(IEnumerable publicKeys) + /// Initializes a new instance of . + /// The FleetUpdateStrategy items on this page. + /// is null. + internal FleetUpdateStrategyListResult(IEnumerable value) { - Argument.AssertNotNull(publicKeys, nameof(publicKeys)); + Argument.AssertNotNull(value, nameof(value)); - PublicKeys = publicKeys.ToList(); + Value = value.ToList(); } - /// Initializes a new instance of . - /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. + /// Initializes a new instance of . + /// The FleetUpdateStrategy items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ContainerServiceSshConfiguration(IList publicKeys, IDictionary serializedAdditionalRawData) + internal FleetUpdateStrategyListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { - PublicKeys = publicKeys; + Value = value; + NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ContainerServiceSshConfiguration() + /// Initializes a new instance of for deserialization. + internal FleetUpdateStrategyListResult() { } - /// The list of SSH public keys used to authenticate with Linux-based VMs. A maximum of 1 key may be specified. - [WirePath("publicKeys")] - public IList PublicKeys { get; } + /// The FleetUpdateStrategy items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyProvisioningState.cs new file mode 100644 index 000000000000..0d4f4ea776a0 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/FleetUpdateStrategyProvisioningState.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 provisioning state of the UpdateStrategy resource. + public readonly partial struct FleetUpdateStrategyProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FleetUpdateStrategyProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static FleetUpdateStrategyProvisioningState Succeeded { get; } = new FleetUpdateStrategyProvisioningState(SucceededValue); + /// Resource creation failed. + public static FleetUpdateStrategyProvisioningState Failed { get; } = new FleetUpdateStrategyProvisioningState(FailedValue); + /// Resource creation was canceled. + public static FleetUpdateStrategyProvisioningState Canceled { get; } = new FleetUpdateStrategyProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(FleetUpdateStrategyProvisioningState left, FleetUpdateStrategyProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FleetUpdateStrategyProvisioningState left, FleetUpdateStrategyProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FleetUpdateStrategyProvisioningState(string value) => new FleetUpdateStrategyProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FleetUpdateStrategyProvisioningState other && Equals(other); + /// + public bool Equals(FleetUpdateStrategyProvisioningState 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/GpuInstanceProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuInstanceProfile.cs deleted file mode 100644 index a56607d6848f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/GpuInstanceProfile.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - public readonly partial struct GpuInstanceProfile : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public GpuInstanceProfile(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string Mig1GValue = "MIG1g"; - private const string Mig2GValue = "MIG2g"; - private const string Mig3GValue = "MIG3g"; - private const string Mig4GValue = "MIG4g"; - private const string Mig7GValue = "MIG7g"; - - /// MIG1g. - public static GpuInstanceProfile Mig1G { get; } = new GpuInstanceProfile(Mig1GValue); - /// MIG2g. - public static GpuInstanceProfile Mig2G { get; } = new GpuInstanceProfile(Mig2GValue); - /// MIG3g. - public static GpuInstanceProfile Mig3G { get; } = new GpuInstanceProfile(Mig3GValue); - /// MIG4g. - public static GpuInstanceProfile Mig4G { get; } = new GpuInstanceProfile(Mig4GValue); - /// MIG7g. - public static GpuInstanceProfile Mig7G { get; } = new GpuInstanceProfile(Mig7GValue); - /// Determines if two values are the same. - public static bool operator ==(GpuInstanceProfile left, GpuInstanceProfile right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(GpuInstanceProfile left, GpuInstanceProfile right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator GpuInstanceProfile(string value) => new GpuInstanceProfile(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is GpuInstanceProfile other && Equals(other); - /// - public bool Equals(GpuInstanceProfile 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 deleted file mode 100644 index f7b4e1596c14..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IPFamily.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 version to use for cluster networking and IP assignment. - public readonly partial struct IPFamily : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IPFamily(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IPv4Value = "IPv4"; - private const string IPv6Value = "IPv6"; - - /// IPv4. - public static IPFamily IPv4 { get; } = new IPFamily(IPv4Value); - /// IPv6. - 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); - /// Determines if two values are not the same. - public static bool operator !=(IPFamily left, IPFamily right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator IPFamily(string value) => new IPFamily(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is IPFamily other && Equals(other); - /// - public bool Equals(IPFamily 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/IstioCertificateAuthority.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.Serialization.cs deleted file mode 100644 index 6130fd5a23d0..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 IstioCertificateAuthority : 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(IstioCertificateAuthority)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Plugin)) - { - writer.WritePropertyName("plugin"u8); - writer.WriteObjectValue(Plugin, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IstioCertificateAuthority 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(IstioCertificateAuthority)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioCertificateAuthority(document.RootElement, options); - } - - internal static IstioCertificateAuthority DeserializeIstioCertificateAuthority(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IstioPluginCertificateAuthority plugin = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("plugin"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - plugin = IstioPluginCertificateAuthority.DeserializeIstioPluginCertificateAuthority(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IstioCertificateAuthority(plugin, 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(Plugin), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" plugin: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Plugin)) - { - builder.Append(" plugin: "); - BicepSerializationHelpers.AppendChildObject(builder, Plugin, options, 2, false, " plugin: "); - } - } - - 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(IstioCertificateAuthority)} does not support writing '{options.Format}' format."); - } - } - - IstioCertificateAuthority 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); - return DeserializeIstioCertificateAuthority(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IstioCertificateAuthority)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.cs deleted file mode 100644 index 967dbaff3926..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioCertificateAuthority.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin certificates as described here https://aka.ms/asm-plugin-ca. - internal partial class IstioCertificateAuthority - { - /// - /// 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 IstioCertificateAuthority() - { - } - - /// Initializes a new instance of . - /// Plugin certificates information for Service Mesh. - /// Keeps track of any properties unknown to the library. - internal IstioCertificateAuthority(IstioPluginCertificateAuthority plugin, IDictionary serializedAdditionalRawData) - { - Plugin = plugin; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Plugin certificates information for Service Mesh. - [WirePath("plugin")] - public IstioPluginCertificateAuthority Plugin { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.cs deleted file mode 100644 index 251aa7fa5a83..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -{ - /// Istio components configuration. - public partial class IstioComponents - { - /// - /// 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 IstioComponents() - { - IngressGateways = new ChangeTrackingList(); - EgressGateways = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Istio ingress gateways. - /// Istio egress gateways. - /// Keeps track of any properties unknown to the library. - internal IstioComponents(IList ingressGateways, IList egressGateways, IDictionary serializedAdditionalRawData) - { - IngressGateways = ingressGateways; - EgressGateways = egressGateways; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Istio ingress gateways. - [WirePath("ingressGateways")] - public IList IngressGateways { get; } - /// Istio egress gateways. - [WirePath("egressGateways")] - public IList EgressGateways { get; } - } -} 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 deleted file mode 100644 index 02b819db69dc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.Serialization.cs +++ /dev/null @@ -1,221 +0,0 @@ -// 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 IstioEgressGateway : 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(IstioEgressGateway)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled); - if (Optional.IsCollectionDefined(NodeSelector)) - { - writer.WritePropertyName("nodeSelector"u8); - writer.WriteStartObject(); - foreach (var item in NodeSelector) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IstioEgressGateway 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(IstioEgressGateway)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioEgressGateway(document.RootElement, options); - } - - internal static IstioEgressGateway DeserializeIstioEgressGateway(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool enabled = default; - IDictionary nodeSelector = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("enabled"u8)) - { - enabled = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("nodeSelector"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; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IstioEgressGateway(enabled, nodeSelector ?? new ChangeTrackingDictionary(), 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enabled: "); - var boolValue = IsEnabled == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeSelector), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeSelector: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeSelector)) - { - if (NodeSelector.Any()) - { - 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("}"); - 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(IstioEgressGateway)} does not support writing '{options.Format}' format."); - } - } - - IstioEgressGateway 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); - return DeserializeIstioEgressGateway(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IstioEgressGateway)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs deleted file mode 100644 index c58b696e03c7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioEgressGateway.cs +++ /dev/null @@ -1,79 +0,0 @@ -// 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 -{ - /// Istio egress gateway configuration. - public partial class IstioEgressGateway - { - /// - /// 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 to enable the egress gateway. - public IstioEgressGateway(bool isEnabled) - { - IsEnabled = isEnabled; - NodeSelector = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// Whether to enable the egress gateway. - /// NodeSelector for scheduling the egress gateway. - /// Keeps track of any properties unknown to the library. - internal IstioEgressGateway(bool isEnabled, IDictionary nodeSelector, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - NodeSelector = nodeSelector; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - 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; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.Serialization.cs deleted file mode 100644 index 8c2ef53a3ac9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.Serialization.cs +++ /dev/null @@ -1,177 +0,0 @@ -// 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 IstioIngressGateway : 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(IstioIngressGateway)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.ToString()); - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled); - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IstioIngressGateway 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(IstioIngressGateway)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioIngressGateway(document.RootElement, options); - } - - internal static IstioIngressGateway DeserializeIstioIngressGateway(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IstioIngressGatewayMode mode = default; - bool enabled = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("mode"u8)) - { - mode = new IstioIngressGatewayMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("enabled"u8)) - { - enabled = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IstioIngressGateway(mode, 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(Mode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" mode: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" mode: "); - builder.AppendLine($"'{Mode.ToString()}'"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enabled: "); - var boolValue = IsEnabled == 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(IstioIngressGateway)} does not support writing '{options.Format}' format."); - } - } - - IstioIngressGateway 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); - return DeserializeIstioIngressGateway(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IstioIngressGateway)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.cs deleted file mode 100644 index 08dd26ee560e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGateway.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// Istio ingress gateway configuration. For now, we support up to one external ingress gateway named `aks-istio-ingressgateway-external` and one internal ingress gateway named `aks-istio-ingressgateway-internal`. - public partial class IstioIngressGateway - { - /// - /// 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 . - /// Mode of an ingress gateway. - /// Whether to enable the ingress gateway. - public IstioIngressGateway(IstioIngressGatewayMode mode, bool isEnabled) - { - Mode = mode; - IsEnabled = isEnabled; - } - - /// Initializes a new instance of . - /// Mode of an ingress gateway. - /// Whether to enable the ingress gateway. - /// Keeps track of any properties unknown to the library. - internal IstioIngressGateway(IstioIngressGatewayMode mode, bool isEnabled, IDictionary serializedAdditionalRawData) - { - Mode = mode; - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal IstioIngressGateway() - { - } - - /// Mode of an ingress gateway. - [WirePath("mode")] - public IstioIngressGatewayMode Mode { get; set; } - /// Whether to enable the ingress gateway. - [WirePath("enabled")] - public bool IsEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGatewayMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGatewayMode.cs deleted file mode 100644 index 447d137919ae..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioIngressGatewayMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 an ingress gateway. - public readonly partial struct IstioIngressGatewayMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public IstioIngressGatewayMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string ExternalValue = "External"; - private const string InternalValue = "Internal"; - - /// The ingress gateway is assigned a public IP address and is publicly accessible. - public static IstioIngressGatewayMode External { get; } = new IstioIngressGatewayMode(ExternalValue); - /// The ingress gateway is assigned an internal IP address and cannot is accessed publicly. - public static IstioIngressGatewayMode Internal { get; } = new IstioIngressGatewayMode(InternalValue); - /// Determines if two values are the same. - public static bool operator ==(IstioIngressGatewayMode left, IstioIngressGatewayMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(IstioIngressGatewayMode left, IstioIngressGatewayMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator IstioIngressGatewayMode(string value) => new IstioIngressGatewayMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is IstioIngressGatewayMode other && Equals(other); - /// - public bool Equals(IstioIngressGatewayMode 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/IstioPluginCertificateAuthority.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.Serialization.cs deleted file mode 100644 index 7e1c08e6fdf1..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.Serialization.cs +++ /dev/null @@ -1,308 +0,0 @@ -// 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 IstioPluginCertificateAuthority : 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(IstioPluginCertificateAuthority)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(KeyVaultId)) - { - writer.WritePropertyName("keyVaultId"u8); - writer.WriteStringValue(KeyVaultId); - } - if (Optional.IsDefined(CertObjectName)) - { - writer.WritePropertyName("certObjectName"u8); - writer.WriteStringValue(CertObjectName); - } - if (Optional.IsDefined(KeyObjectName)) - { - writer.WritePropertyName("keyObjectName"u8); - writer.WriteStringValue(KeyObjectName); - } - if (Optional.IsDefined(RootCertObjectName)) - { - writer.WritePropertyName("rootCertObjectName"u8); - writer.WriteStringValue(RootCertObjectName); - } - if (Optional.IsDefined(CertChainObjectName)) - { - writer.WritePropertyName("certChainObjectName"u8); - writer.WriteStringValue(CertChainObjectName); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IstioPluginCertificateAuthority 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(IstioPluginCertificateAuthority)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioPluginCertificateAuthority(document.RootElement, options); - } - - internal static IstioPluginCertificateAuthority DeserializeIstioPluginCertificateAuthority(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier keyVaultId = default; - string certObjectName = default; - string keyObjectName = default; - string rootCertObjectName = default; - string certChainObjectName = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keyVaultId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("certObjectName"u8)) - { - certObjectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyObjectName"u8)) - { - keyObjectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("rootCertObjectName"u8)) - { - rootCertObjectName = property.Value.GetString(); - continue; - } - if (property.NameEquals("certChainObjectName"u8)) - { - certChainObjectName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IstioPluginCertificateAuthority( - keyVaultId, - certObjectName, - keyObjectName, - rootCertObjectName, - certChainObjectName, - 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(KeyVaultId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keyVaultId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KeyVaultId)) - { - builder.Append(" keyVaultId: "); - builder.AppendLine($"'{KeyVaultId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertObjectName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" certObjectName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CertObjectName)) - { - builder.Append(" certObjectName: "); - if (CertObjectName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CertObjectName}'''"); - } - else - { - builder.AppendLine($"'{CertObjectName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyObjectName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keyObjectName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KeyObjectName)) - { - builder.Append(" keyObjectName: "); - if (KeyObjectName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{KeyObjectName}'''"); - } - else - { - builder.AppendLine($"'{KeyObjectName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RootCertObjectName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rootCertObjectName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RootCertObjectName)) - { - builder.Append(" rootCertObjectName: "); - if (RootCertObjectName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RootCertObjectName}'''"); - } - else - { - builder.AppendLine($"'{RootCertObjectName}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertChainObjectName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" certChainObjectName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CertChainObjectName)) - { - builder.Append(" certChainObjectName: "); - if (CertChainObjectName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CertChainObjectName}'''"); - } - else - { - builder.AppendLine($"'{CertChainObjectName}'"); - } - } - } - - 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(IstioPluginCertificateAuthority)} does not support writing '{options.Format}' format."); - } - } - - IstioPluginCertificateAuthority 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); - return DeserializeIstioPluginCertificateAuthority(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IstioPluginCertificateAuthority)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.cs deleted file mode 100644 index d4655ec69313..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioPluginCertificateAuthority.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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 -{ - /// Plugin certificates information for Service Mesh. - public partial class IstioPluginCertificateAuthority - { - /// - /// 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 IstioPluginCertificateAuthority() - { - } - - /// Initializes a new instance of . - /// The resource ID of the Key Vault. - /// Intermediate certificate object name in Azure Key Vault. - /// Intermediate certificate private key object name in Azure Key Vault. - /// Root certificate object name in Azure Key Vault. - /// Certificate chain object name in Azure Key Vault. - /// Keeps track of any properties unknown to the library. - internal IstioPluginCertificateAuthority(ResourceIdentifier keyVaultId, string certObjectName, string keyObjectName, string rootCertObjectName, string certChainObjectName, IDictionary serializedAdditionalRawData) - { - KeyVaultId = keyVaultId; - CertObjectName = certObjectName; - KeyObjectName = keyObjectName; - RootCertObjectName = rootCertObjectName; - CertChainObjectName = certChainObjectName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The resource ID of the Key Vault. - [WirePath("keyVaultId")] - public ResourceIdentifier KeyVaultId { get; set; } - /// Intermediate certificate object name in Azure Key Vault. - [WirePath("certObjectName")] - public string CertObjectName { get; set; } - /// Intermediate certificate private key object name in Azure Key Vault. - [WirePath("keyObjectName")] - public string KeyObjectName { get; set; } - /// Root certificate object name in Azure Key Vault. - [WirePath("rootCertObjectName")] - public string RootCertObjectName { get; set; } - /// Certificate chain object name in Azure Key Vault. - [WirePath("certChainObjectName")] - public string CertChainObjectName { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.Serialization.cs deleted file mode 100644 index a2ad8a209b0c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.Serialization.cs +++ /dev/null @@ -1,261 +0,0 @@ -// 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 IstioServiceMesh : 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(IstioServiceMesh)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Components)) - { - writer.WritePropertyName("components"u8); - writer.WriteObjectValue(Components, options); - } - if (Optional.IsDefined(CertificateAuthority)) - { - writer.WritePropertyName("certificateAuthority"u8); - writer.WriteObjectValue(CertificateAuthority, options); - } - if (Optional.IsCollectionDefined(Revisions)) - { - writer.WritePropertyName("revisions"u8); - writer.WriteStartArray(); - foreach (var item in Revisions) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - IstioServiceMesh 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(IstioServiceMesh)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioServiceMesh(document.RootElement, options); - } - - internal static IstioServiceMesh DeserializeIstioServiceMesh(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IstioComponents components = default; - IstioCertificateAuthority certificateAuthority = default; - IList revisions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("components"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - components = IstioComponents.DeserializeIstioComponents(property.Value, options); - continue; - } - if (property.NameEquals("certificateAuthority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - certificateAuthority = IstioCertificateAuthority.DeserializeIstioCertificateAuthority(property.Value, options); - continue; - } - if (property.NameEquals("revisions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - revisions = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new IstioServiceMesh(components, certificateAuthority, revisions ?? 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(Components), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" components: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Components)) - { - builder.Append(" components: "); - BicepSerializationHelpers.AppendChildObject(builder, Components, options, 2, false, " components: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CertificateAuthorityPlugin", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" certificateAuthority: "); - builder.AppendLine("{"); - builder.Append(" plugin: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(CertificateAuthority)) - { - builder.Append(" certificateAuthority: "); - BicepSerializationHelpers.AppendChildObject(builder, CertificateAuthority, options, 2, false, " certificateAuthority: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Revisions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" revisions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Revisions)) - { - if (Revisions.Any()) - { - builder.Append(" revisions: "); - builder.AppendLine("["); - foreach (var item in Revisions) - { - 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(IstioServiceMesh)} does not support writing '{options.Format}' format."); - } - } - - IstioServiceMesh 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); - return DeserializeIstioServiceMesh(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(IstioServiceMesh)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.cs deleted file mode 100644 index 7a275309424b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioServiceMesh.cs +++ /dev/null @@ -1,89 +0,0 @@ -// 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 -{ - /// Istio service mesh configuration. - public partial class IstioServiceMesh - { - /// - /// 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 IstioServiceMesh() - { - Revisions = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Istio components configuration. - /// Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin certificates as described here https://aka.ms/asm-plugin-ca. - /// The list of revisions of the Istio control plane. When an upgrade is not in progress, this holds one value. When canary upgrade is in progress, this can only hold two consecutive values. For more information, see: https://learn.microsoft.com/en-us/azure/aks/istio-upgrade. - /// Keeps track of any properties unknown to the library. - internal IstioServiceMesh(IstioComponents components, IstioCertificateAuthority certificateAuthority, IList revisions, IDictionary serializedAdditionalRawData) - { - Components = components; - CertificateAuthority = certificateAuthority; - Revisions = revisions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Istio components configuration. - [WirePath("components")] - public IstioComponents Components { get; set; } - /// Istio Service Mesh Certificate Authority (CA) configuration. For now, we only support plugin certificates as described here https://aka.ms/asm-plugin-ca. - internal IstioCertificateAuthority CertificateAuthority { get; set; } - /// Plugin certificates information for Service Mesh. - [WirePath("certificateAuthority.plugin")] - public IstioPluginCertificateAuthority CertificateAuthorityPlugin - { - get => CertificateAuthority is null ? default : CertificateAuthority.Plugin; - set - { - if (CertificateAuthority is null) - CertificateAuthority = new IstioCertificateAuthority(); - CertificateAuthority.Plugin = value; - } - } - - /// The list of revisions of the Istio control plane. When an upgrade is not in progress, this holds one value. When canary upgrade is in progress, this can only hold two consecutive values. For more information, see: https://learn.microsoft.com/en-us/azure/aks/istio-upgrade. - [WirePath("revisions")] - public IList Revisions { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeConfigFormat.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeConfigFormat.cs deleted file mode 100644 index 7db67c07f947..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeConfigFormat.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 KubeConfigFormat. - public readonly partial struct KubeConfigFormat : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public KubeConfigFormat(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AzureValue = "azure"; - private const string ExecValue = "exec"; - - /// Return azure auth-provider kubeconfig. This format is deprecated in v1.22 and will be fully removed in v1.26. See: https://aka.ms/k8s/changes-1-26. - public static KubeConfigFormat Azure { get; } = new KubeConfigFormat(AzureValue); - /// Return exec format kubeconfig. This format requires kubelogin binary in the path. - public static KubeConfigFormat Exec { get; } = new KubeConfigFormat(ExecValue); - /// Determines if two values are the same. - public static bool operator ==(KubeConfigFormat left, KubeConfigFormat right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(KubeConfigFormat left, KubeConfigFormat right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator KubeConfigFormat(string value) => new KubeConfigFormat(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is KubeConfigFormat other && Equals(other); - /// - public bool Equals(KubeConfigFormat 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/KubeletConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs deleted file mode 100644 index 8fff09734d85..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.Serialization.cs +++ /dev/null @@ -1,524 +0,0 @@ -// 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 KubeletConfig : 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(KubeletConfig)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(CpuManagerPolicy)) - { - writer.WritePropertyName("cpuManagerPolicy"u8); - writer.WriteStringValue(CpuManagerPolicy); - } - if (Optional.IsDefined(IsCpuCfsQuotaEnabled)) - { - writer.WritePropertyName("cpuCfsQuota"u8); - writer.WriteBooleanValue(IsCpuCfsQuotaEnabled.Value); - } - if (Optional.IsDefined(CpuCfsQuotaPeriod)) - { - writer.WritePropertyName("cpuCfsQuotaPeriod"u8); - writer.WriteStringValue(CpuCfsQuotaPeriod); - } - if (Optional.IsDefined(ImageGcHighThreshold)) - { - writer.WritePropertyName("imageGcHighThreshold"u8); - writer.WriteNumberValue(ImageGcHighThreshold.Value); - } - if (Optional.IsDefined(ImageGcLowThreshold)) - { - writer.WritePropertyName("imageGcLowThreshold"u8); - writer.WriteNumberValue(ImageGcLowThreshold.Value); - } - if (Optional.IsDefined(TopologyManagerPolicy)) - { - writer.WritePropertyName("topologyManagerPolicy"u8); - writer.WriteStringValue(TopologyManagerPolicy); - } - if (Optional.IsCollectionDefined(AllowedUnsafeSysctls)) - { - writer.WritePropertyName("allowedUnsafeSysctls"u8); - writer.WriteStartArray(); - foreach (var item in AllowedUnsafeSysctls) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(FailStartWithSwapOn)) - { - writer.WritePropertyName("failSwapOn"u8); - writer.WriteBooleanValue(FailStartWithSwapOn.Value); - } - if (Optional.IsDefined(ContainerLogMaxSizeInMB)) - { - writer.WritePropertyName("containerLogMaxSizeMB"u8); - writer.WriteNumberValue(ContainerLogMaxSizeInMB.Value); - } - if (Optional.IsDefined(ContainerLogMaxFiles)) - { - writer.WritePropertyName("containerLogMaxFiles"u8); - writer.WriteNumberValue(ContainerLogMaxFiles.Value); - } - if (Optional.IsDefined(PodMaxPids)) - { - writer.WritePropertyName("podMaxPids"u8); - writer.WriteNumberValue(PodMaxPids.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KubeletConfig 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(KubeletConfig)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKubeletConfig(document.RootElement, options); - } - - internal static KubeletConfig DeserializeKubeletConfig(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string cpuManagerPolicy = default; - bool? cpuCfsQuota = default; - string cpuCfsQuotaPeriod = default; - int? imageGcHighThreshold = default; - int? imageGcLowThreshold = default; - string topologyManagerPolicy = default; - IList allowedUnsafeSysctls = default; - bool? failSwapOn = default; - int? containerLogMaxSizeMB = default; - int? containerLogMaxFiles = default; - int? podMaxPids = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("cpuManagerPolicy"u8)) - { - cpuManagerPolicy = property.Value.GetString(); - continue; - } - if (property.NameEquals("cpuCfsQuota"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - cpuCfsQuota = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("cpuCfsQuotaPeriod"u8)) - { - cpuCfsQuotaPeriod = property.Value.GetString(); - continue; - } - if (property.NameEquals("imageGcHighThreshold"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageGcHighThreshold = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("imageGcLowThreshold"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageGcLowThreshold = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("topologyManagerPolicy"u8)) - { - topologyManagerPolicy = property.Value.GetString(); - continue; - } - if (property.NameEquals("allowedUnsafeSysctls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - allowedUnsafeSysctls = array; - continue; - } - if (property.NameEquals("failSwapOn"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - failSwapOn = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("containerLogMaxSizeMB"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - containerLogMaxSizeMB = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("containerLogMaxFiles"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - containerLogMaxFiles = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("podMaxPids"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - podMaxPids = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KubeletConfig( - cpuManagerPolicy, - cpuCfsQuota, - cpuCfsQuotaPeriod, - imageGcHighThreshold, - imageGcLowThreshold, - topologyManagerPolicy, - allowedUnsafeSysctls ?? new ChangeTrackingList(), - failSwapOn, - containerLogMaxSizeMB, - containerLogMaxFiles, - podMaxPids, - 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(CpuManagerPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" cpuManagerPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CpuManagerPolicy)) - { - builder.Append(" cpuManagerPolicy: "); - if (CpuManagerPolicy.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CpuManagerPolicy}'''"); - } - else - { - builder.AppendLine($"'{CpuManagerPolicy}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsCpuCfsQuotaEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" cpuCfsQuota: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsCpuCfsQuotaEnabled)) - { - builder.Append(" cpuCfsQuota: "); - var boolValue = IsCpuCfsQuotaEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CpuCfsQuotaPeriod), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" cpuCfsQuotaPeriod: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CpuCfsQuotaPeriod)) - { - builder.Append(" cpuCfsQuotaPeriod: "); - if (CpuCfsQuotaPeriod.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CpuCfsQuotaPeriod}'''"); - } - else - { - builder.AppendLine($"'{CpuCfsQuotaPeriod}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageGcHighThreshold), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" imageGcHighThreshold: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ImageGcHighThreshold)) - { - builder.Append(" imageGcHighThreshold: "); - builder.AppendLine($"{ImageGcHighThreshold.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageGcLowThreshold), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" imageGcLowThreshold: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ImageGcLowThreshold)) - { - builder.Append(" imageGcLowThreshold: "); - builder.AppendLine($"{ImageGcLowThreshold.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TopologyManagerPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" topologyManagerPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TopologyManagerPolicy)) - { - builder.Append(" topologyManagerPolicy: "); - if (TopologyManagerPolicy.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{TopologyManagerPolicy}'''"); - } - else - { - builder.AppendLine($"'{TopologyManagerPolicy}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowedUnsafeSysctls), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" allowedUnsafeSysctls: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AllowedUnsafeSysctls)) - { - if (AllowedUnsafeSysctls.Any()) - { - builder.Append(" allowedUnsafeSysctls: "); - builder.AppendLine("["); - foreach (var item in AllowedUnsafeSysctls) - { - 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(FailStartWithSwapOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" failSwapOn: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FailStartWithSwapOn)) - { - builder.Append(" failSwapOn: "); - var boolValue = FailStartWithSwapOn.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerLogMaxSizeInMB), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" containerLogMaxSizeMB: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ContainerLogMaxSizeInMB)) - { - builder.Append(" containerLogMaxSizeMB: "); - builder.AppendLine($"{ContainerLogMaxSizeInMB.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerLogMaxFiles), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" containerLogMaxFiles: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ContainerLogMaxFiles)) - { - builder.Append(" containerLogMaxFiles: "); - builder.AppendLine($"{ContainerLogMaxFiles.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodMaxPids), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podMaxPids: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodMaxPids)) - { - builder.Append(" podMaxPids: "); - builder.AppendLine($"{PodMaxPids.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(KubeletConfig)} does not support writing '{options.Format}' format."); - } - } - - KubeletConfig 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); - return DeserializeKubeletConfig(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KubeletConfig)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs deleted file mode 100644 index 33c4ce6a4b1b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletConfig.cs +++ /dev/null @@ -1,117 +0,0 @@ -// 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 -{ - /// See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. - public partial class KubeletConfig - { - /// - /// 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 KubeletConfig() - { - AllowedUnsafeSysctls = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. - /// The default is true. - /// The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. - /// To disable image garbage collection, set to 100. The default is 85%. - /// This cannot be set higher than imageGcHighThreshold. The default is 80%. - /// For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. - /// Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). - /// If set to true it will make the Kubelet fail to start if swap is enabled on the node. - /// 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. - /// 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) - { - CpuManagerPolicy = cpuManagerPolicy; - IsCpuCfsQuotaEnabled = isCpuCfsQuotaEnabled; - CpuCfsQuotaPeriod = cpuCfsQuotaPeriod; - ImageGcHighThreshold = imageGcHighThreshold; - ImageGcLowThreshold = imageGcLowThreshold; - TopologyManagerPolicy = topologyManagerPolicy; - AllowedUnsafeSysctls = allowedUnsafeSysctls; - FailStartWithSwapOn = failStartWithSwapOn; - ContainerLogMaxSizeInMB = containerLogMaxSizeInMB; - ContainerLogMaxFiles = containerLogMaxFiles; - PodMaxPids = podMaxPids; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The default is 'none'. See [Kubernetes CPU management policies](https://kubernetes.io/docs/tasks/administer-cluster/cpu-management-policies/#cpu-management-policies) for more information. Allowed values are 'none' and 'static'. - [WirePath("cpuManagerPolicy")] - public string CpuManagerPolicy { get; set; } - /// The default is true. - [WirePath("cpuCfsQuota")] - public bool? IsCpuCfsQuotaEnabled { get; set; } - /// The default is '100ms.' Valid values are a sequence of decimal numbers with an optional fraction and a unit suffix. For example: '300ms', '2h45m'. Supported units are 'ns', 'us', 'ms', 's', 'm', and 'h'. - [WirePath("cpuCfsQuotaPeriod")] - public string CpuCfsQuotaPeriod { get; set; } - /// To disable image garbage collection, set to 100. The default is 85%. - [WirePath("imageGcHighThreshold")] - public int? ImageGcHighThreshold { get; set; } - /// This cannot be set higher than imageGcHighThreshold. The default is 80%. - [WirePath("imageGcLowThreshold")] - public int? ImageGcLowThreshold { get; set; } - /// For more information see [Kubernetes Topology Manager](https://kubernetes.io/docs/tasks/administer-cluster/topology-manager). The default is 'none'. Allowed values are 'none', 'best-effort', 'restricted', and 'single-numa-node'. - [WirePath("topologyManagerPolicy")] - public string TopologyManagerPolicy { get; set; } - /// Allowed list of unsafe sysctls or unsafe sysctl patterns (ending in `*`). - [WirePath("allowedUnsafeSysctls")] - public IList AllowedUnsafeSysctls { get; } - /// If set to true it will make the Kubelet fail to start if swap is enabled on the node. - [WirePath("failSwapOn")] - public bool? FailStartWithSwapOn { get; set; } - /// The maximum size (e.g. 10Mi) of container log file before it is rotated. - [WirePath("containerLogMaxSizeMB")] - public int? ContainerLogMaxSizeInMB { get; set; } - /// The maximum number of container log files that can be present for a container. The number must be ≥ 2. - [WirePath("containerLogMaxFiles")] - public int? ContainerLogMaxFiles { get; set; } - /// The maximum number of processes per pod. - [WirePath("podMaxPids")] - public int? PodMaxPids { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletDiskType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletDiskType.cs deleted file mode 100644 index 3b8de4dd22bc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubeletDiskType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. - public readonly partial struct KubeletDiskType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public KubeletDiskType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OSValue = "OS"; - private const string TemporaryValue = "Temporary"; - - /// Kubelet will use the OS disk for its data. - public static KubeletDiskType OS { get; } = new KubeletDiskType(OSValue); - /// Kubelet will use the temporary disk for its data. - public static KubeletDiskType Temporary { get; } = new KubeletDiskType(TemporaryValue); - /// Determines if two values are the same. - public static bool operator ==(KubeletDiskType left, KubeletDiskType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(KubeletDiskType left, KubeletDiskType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator KubeletDiskType(string value) => new KubeletDiskType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is KubeletDiskType other && Equals(other); - /// - public bool Equals(KubeletDiskType 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/KubernetesPatchVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.Serialization.cs deleted file mode 100644 index c24787d9fa8e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.Serialization.cs +++ /dev/null @@ -1,198 +0,0 @@ -// 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 KubernetesPatchVersion : 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(KubernetesPatchVersion)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Upgrades)) - { - writer.WritePropertyName("upgrades"u8); - writer.WriteStartArray(); - foreach (var item in Upgrades) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KubernetesPatchVersion 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(KubernetesPatchVersion)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKubernetesPatchVersion(document.RootElement, options); - } - - internal static KubernetesPatchVersion DeserializeKubernetesPatchVersion(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList upgrades = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("upgrades"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - upgrades = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KubernetesPatchVersion(upgrades ?? 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(Upgrades), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgrades: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Upgrades)) - { - if (Upgrades.Any()) - { - builder.Append(" upgrades: "); - builder.AppendLine("["); - foreach (var item in Upgrades) - { - 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(KubernetesPatchVersion)} does not support writing '{options.Format}' format."); - } - } - - KubernetesPatchVersion 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); - return DeserializeKubernetesPatchVersion(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KubernetesPatchVersion)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.cs deleted file mode 100644 index e0dd89687211..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesPatchVersion.cs +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -{ - /// Kubernetes patch version profile. - public partial class KubernetesPatchVersion - { - /// - /// 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 KubernetesPatchVersion() - { - Upgrades = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Possible upgrade path for given patch version. - /// Keeps track of any properties unknown to the library. - internal KubernetesPatchVersion(IReadOnlyList upgrades, IDictionary serializedAdditionalRawData) - { - Upgrades = upgrades; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Possible upgrade path for given patch version. - [WirePath("upgrades")] - public IReadOnlyList Upgrades { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesSupportPlan.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesSupportPlan.cs deleted file mode 100644 index 4679c638d9fc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesSupportPlan.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Different support tiers for AKS managed clusters. - public readonly partial struct KubernetesSupportPlan : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public KubernetesSupportPlan(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string KubernetesOfficialValue = "KubernetesOfficial"; - private const string AKSLongTermSupportValue = "AKSLongTermSupport"; - - /// Support for the version is the same as for the open source Kubernetes offering. Official Kubernetes open source community support versions for 1 year after release. - public static KubernetesSupportPlan KubernetesOfficial { get; } = new KubernetesSupportPlan(KubernetesOfficialValue); - /// Support for the version extended past the KubernetesOfficial support of 1 year. AKS continues to patch CVEs for another 1 year, for a total of 2 years of support. - public static KubernetesSupportPlan AKSLongTermSupport { get; } = new KubernetesSupportPlan(AKSLongTermSupportValue); - /// Determines if two values are the same. - public static bool operator ==(KubernetesSupportPlan left, KubernetesSupportPlan right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(KubernetesSupportPlan left, KubernetesSupportPlan right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator KubernetesSupportPlan(string value) => new KubernetesSupportPlan(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is KubernetesSupportPlan other && Equals(other); - /// - public bool Equals(KubernetesSupportPlan 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/KubernetesVersion.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs deleted file mode 100644 index 96b1eb4bbfca..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.Serialization.cs +++ /dev/null @@ -1,285 +0,0 @@ -// 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 KubernetesVersion : 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(KubernetesVersion)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Version)) - { - writer.WritePropertyName("version"u8); - writer.WriteStringValue(Version); - } - if (Optional.IsDefined(Capabilities)) - { - writer.WritePropertyName("capabilities"u8); - writer.WriteObjectValue(Capabilities, options); - } - if (Optional.IsDefined(IsPreview)) - { - writer.WritePropertyName("isPreview"u8); - writer.WriteBooleanValue(IsPreview.Value); - } - if (Optional.IsCollectionDefined(PatchVersions)) - { - writer.WritePropertyName("patchVersions"u8); - writer.WriteStartObject(); - foreach (var item in PatchVersions) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value, options); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KubernetesVersion 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(KubernetesVersion)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKubernetesVersion(document.RootElement, options); - } - - internal static KubernetesVersion DeserializeKubernetesVersion(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string version = default; - KubernetesVersionCapabilities capabilities = default; - bool? isPreview = default; - IReadOnlyDictionary patchVersions = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("version"u8)) - { - version = property.Value.GetString(); - continue; - } - if (property.NameEquals("capabilities"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capabilities = KubernetesVersionCapabilities.DeserializeKubernetesVersionCapabilities(property.Value, options); - continue; - } - if (property.NameEquals("isPreview"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isPreview = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("patchVersions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, KubernetesPatchVersion.DeserializeKubernetesPatchVersion(property0.Value, options)); - } - patchVersions = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KubernetesVersion(version, capabilities, isPreview, patchVersions ?? new ChangeTrackingDictionary(), 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(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("CapabilitiesSupportPlan", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" capabilities: "); - builder.AppendLine("{"); - builder.Append(" supportPlan: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(Capabilities)) - { - builder.Append(" capabilities: "); - BicepSerializationHelpers.AppendChildObject(builder, Capabilities, options, 2, false, " capabilities: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPreview), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isPreview: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsPreview)) - { - builder.Append(" isPreview: "); - var boolValue = IsPreview.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PatchVersions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" patchVersions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PatchVersions)) - { - if (PatchVersions.Any()) - { - builder.Append(" patchVersions: "); - builder.AppendLine("{"); - foreach (var item in PatchVersions) - { - builder.Append($" '{item.Key}': "); - BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 4, false, " patchVersions: "); - } - 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(KubernetesVersion)} does not support writing '{options.Format}' format."); - } - } - - KubernetesVersion 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); - return DeserializeKubernetesVersion(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KubernetesVersion)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs deleted file mode 100644 index 1eedcc878d7c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersion.cs +++ /dev/null @@ -1,88 +0,0 @@ -// 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 -{ - /// Kubernetes version profile for given major.minor release. - public partial class KubernetesVersion - { - /// - /// 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 KubernetesVersion() - { - PatchVersions = new ChangeTrackingDictionary(); - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal KubernetesVersion(string version, KubernetesVersionCapabilities capabilities, bool? isPreview, IReadOnlyDictionary patchVersions, IDictionary serializedAdditionalRawData) - { - Version = version; - Capabilities = capabilities; - IsPreview = isPreview; - PatchVersions = patchVersions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// major.minor version of Kubernetes release. - [WirePath("version")] - public string Version { get; } - /// Capabilities on this Kubernetes version. - internal KubernetesVersionCapabilities Capabilities { get; } - /// Gets the capabilities support plan. - [WirePath("capabilities.supportPlan")] - public IReadOnlyList CapabilitiesSupportPlan - { - get => Capabilities?.SupportPlan; - } - - /// Whether this version is in preview mode. - [WirePath("isPreview")] - public bool? IsPreview { get; } - /// Patch versions of Kubernetes release. - [WirePath("patchVersions")] - public IReadOnlyDictionary PatchVersions { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.Serialization.cs deleted file mode 100644 index 9883515282be..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.Serialization.cs +++ /dev/null @@ -1,185 +0,0 @@ -// 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 KubernetesVersionCapabilities : 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(KubernetesVersionCapabilities)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(SupportPlan)) - { - writer.WritePropertyName("supportPlan"u8); - writer.WriteStartArray(); - foreach (var item in SupportPlan) - { - writer.WriteStringValue(item.ToString()); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KubernetesVersionCapabilities 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(KubernetesVersionCapabilities)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKubernetesVersionCapabilities(document.RootElement, options); - } - - internal static KubernetesVersionCapabilities DeserializeKubernetesVersionCapabilities(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList supportPlan = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("supportPlan"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(new KubernetesSupportPlan(item.GetString())); - } - supportPlan = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KubernetesVersionCapabilities(supportPlan ?? 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(SupportPlan), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" supportPlan: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(SupportPlan)) - { - if (SupportPlan.Any()) - { - builder.Append(" supportPlan: "); - builder.AppendLine("["); - foreach (var item in SupportPlan) - { - builder.AppendLine($" '{item.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(KubernetesVersionCapabilities)} does not support writing '{options.Format}' format."); - } - } - - KubernetesVersionCapabilities 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); - return DeserializeKubernetesVersionCapabilities(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KubernetesVersionCapabilities)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.cs deleted file mode 100644 index 6adbfcfd3c9e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionCapabilities.cs +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -{ - /// Capabilities on this Kubernetes version. - internal partial class KubernetesVersionCapabilities - { - /// - /// 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 KubernetesVersionCapabilities() - { - SupportPlan = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal KubernetesVersionCapabilities(IReadOnlyList supportPlan, IDictionary serializedAdditionalRawData) - { - SupportPlan = supportPlan; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the support plan. - [WirePath("supportPlan")] - public IReadOnlyList SupportPlan { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.Serialization.cs deleted file mode 100644 index e94bbd9c065a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.Serialization.cs +++ /dev/null @@ -1,185 +0,0 @@ -// 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 KubernetesVersionListResult : 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(KubernetesVersionListResult)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(Values)) - { - writer.WritePropertyName("values"u8); - writer.WriteStartArray(); - foreach (var item in Values) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - KubernetesVersionListResult 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(KubernetesVersionListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeKubernetesVersionListResult(document.RootElement, options); - } - - internal static KubernetesVersionListResult DeserializeKubernetesVersionListResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList values = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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(KubernetesVersion.DeserializeKubernetesVersion(item, options)); - } - values = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new KubernetesVersionListResult(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(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) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " values: "); - } - 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(KubernetesVersionListResult)} does not support writing '{options.Format}' format."); - } - } - - KubernetesVersionListResult 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); - return DeserializeKubernetesVersionListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(KubernetesVersionListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs deleted file mode 100644 index 32f1b3bd514e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.Serialization.cs +++ /dev/null @@ -1,264 +0,0 @@ -// 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 LinuxOSConfig : 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(LinuxOSConfig)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Sysctls)) - { - writer.WritePropertyName("sysctls"u8); - writer.WriteObjectValue(Sysctls, options); - } - if (Optional.IsDefined(TransparentHugePageEnabled)) - { - writer.WritePropertyName("transparentHugePageEnabled"u8); - writer.WriteStringValue(TransparentHugePageEnabled); - } - if (Optional.IsDefined(TransparentHugePageDefrag)) - { - writer.WritePropertyName("transparentHugePageDefrag"u8); - writer.WriteStringValue(TransparentHugePageDefrag); - } - if (Optional.IsDefined(SwapFileSizeInMB)) - { - writer.WritePropertyName("swapFileSizeMB"u8); - writer.WriteNumberValue(SwapFileSizeInMB.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - LinuxOSConfig 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(LinuxOSConfig)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLinuxOSConfig(document.RootElement, options); - } - - internal static LinuxOSConfig DeserializeLinuxOSConfig(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - SysctlConfig sysctls = default; - string transparentHugePageEnabled = default; - string transparentHugePageDefrag = default; - int? swapFileSizeMB = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("sysctls"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sysctls = SysctlConfig.DeserializeSysctlConfig(property.Value, options); - continue; - } - if (property.NameEquals("transparentHugePageEnabled"u8)) - { - transparentHugePageEnabled = property.Value.GetString(); - continue; - } - if (property.NameEquals("transparentHugePageDefrag"u8)) - { - transparentHugePageDefrag = property.Value.GetString(); - continue; - } - if (property.NameEquals("swapFileSizeMB"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - swapFileSizeMB = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new LinuxOSConfig(sysctls, transparentHugePageEnabled, transparentHugePageDefrag, swapFileSizeMB, 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(Sysctls), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" sysctls: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Sysctls)) - { - builder.Append(" sysctls: "); - BicepSerializationHelpers.AppendChildObject(builder, Sysctls, options, 2, false, " sysctls: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TransparentHugePageEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" transparentHugePageEnabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TransparentHugePageEnabled)) - { - builder.Append(" transparentHugePageEnabled: "); - if (TransparentHugePageEnabled.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{TransparentHugePageEnabled}'''"); - } - else - { - builder.AppendLine($"'{TransparentHugePageEnabled}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TransparentHugePageDefrag), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" transparentHugePageDefrag: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TransparentHugePageDefrag)) - { - builder.Append(" transparentHugePageDefrag: "); - if (TransparentHugePageDefrag.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{TransparentHugePageDefrag}'''"); - } - else - { - builder.AppendLine($"'{TransparentHugePageDefrag}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SwapFileSizeInMB), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" swapFileSizeMB: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SwapFileSizeInMB)) - { - builder.Append(" swapFileSizeMB: "); - builder.AppendLine($"{SwapFileSizeInMB.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(LinuxOSConfig)} does not support writing '{options.Format}' format."); - } - } - - LinuxOSConfig 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); - return DeserializeLinuxOSConfig(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LinuxOSConfig)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs deleted file mode 100644 index 119559471f6f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/LinuxOSConfig.cs +++ /dev/null @@ -1,81 +0,0 @@ -// 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 -{ - /// See [AKS custom node configuration](https://docs.microsoft.com/azure/aks/custom-node-configuration) for more details. - public partial class LinuxOSConfig - { - /// - /// 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 LinuxOSConfig() - { - } - - /// Initializes a new instance of . - /// Sysctl settings for Linux agent nodes. - /// Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - /// Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - /// The size in MB of a swap file that will be created on each node. - /// Keeps track of any properties unknown to the library. - internal LinuxOSConfig(SysctlConfig sysctls, string transparentHugePageEnabled, string transparentHugePageDefrag, int? swapFileSizeInMB, IDictionary serializedAdditionalRawData) - { - Sysctls = sysctls; - TransparentHugePageEnabled = transparentHugePageEnabled; - TransparentHugePageDefrag = transparentHugePageDefrag; - SwapFileSizeInMB = swapFileSizeInMB; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Sysctl settings for Linux agent nodes. - [WirePath("sysctls")] - public SysctlConfig Sysctls { get; set; } - /// Valid values are 'always', 'madvise', and 'never'. The default is 'always'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - [WirePath("transparentHugePageEnabled")] - public string TransparentHugePageEnabled { get; set; } - /// Valid values are 'always', 'defer', 'defer+madvise', 'madvise' and 'never'. The default is 'madvise'. For more information see [Transparent Hugepages](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html#admin-guide-transhuge). - [WirePath("transparentHugePageDefrag")] - public string TransparentHugePageDefrag { get; set; } - /// The size in MB of a swap file that will be created on each node. - [WirePath("swapFileSizeMB")] - public int? SwapFileSizeInMB { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs deleted file mode 100644 index 78e837783383..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.Serialization.cs +++ /dev/null @@ -1,379 +0,0 @@ -// 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 ManagedClusterAadProfile : 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(ManagedClusterAadProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsManagedAadEnabled)) - { - writer.WritePropertyName("managed"u8); - writer.WriteBooleanValue(IsManagedAadEnabled.Value); - } - if (Optional.IsDefined(IsAzureRbacEnabled)) - { - writer.WritePropertyName("enableAzureRBAC"u8); - writer.WriteBooleanValue(IsAzureRbacEnabled.Value); - } - if (Optional.IsCollectionDefined(AdminGroupObjectIds)) - { - writer.WritePropertyName("adminGroupObjectIDs"u8); - writer.WriteStartArray(); - foreach (var item in AdminGroupObjectIds) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ClientAppId)) - { - writer.WritePropertyName("clientAppID"u8); - writer.WriteStringValue(ClientAppId.Value); - } - if (Optional.IsDefined(ServerAppId)) - { - writer.WritePropertyName("serverAppID"u8); - writer.WriteStringValue(ServerAppId.Value); - } - if (Optional.IsDefined(ServerAppSecret)) - { - writer.WritePropertyName("serverAppSecret"u8); - writer.WriteStringValue(ServerAppSecret); - } - if (Optional.IsDefined(TenantId)) - { - writer.WritePropertyName("tenantID"u8); - writer.WriteStringValue(TenantId.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAadProfile 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(ManagedClusterAadProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAadProfile(document.RootElement, options); - } - - internal static ManagedClusterAadProfile DeserializeManagedClusterAadProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? managed = default; - bool? enableAzureRBAC = default; - IList adminGroupObjectIds = default; - Guid? clientAppId = default; - Guid? serverAppId = default; - string serverAppSecret = default; - Guid? tenantId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("managed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managed = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableAzureRBAC"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableAzureRBAC = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("adminGroupObjectIDs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetGuid()); - } - adminGroupObjectIds = array; - continue; - } - if (property.NameEquals("clientAppID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clientAppId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("serverAppID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - serverAppId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("serverAppSecret"u8)) - { - serverAppSecret = property.Value.GetString(); - continue; - } - if (property.NameEquals("tenantID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - tenantId = property.Value.GetGuid(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAadProfile( - managed, - enableAzureRBAC, - adminGroupObjectIds ?? new ChangeTrackingList(), - clientAppId, - serverAppId, - serverAppSecret, - tenantId, - 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(IsManagedAadEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" managed: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsManagedAadEnabled)) - { - builder.Append(" managed: "); - var boolValue = IsManagedAadEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsAzureRbacEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableAzureRBAC: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsAzureRbacEnabled)) - { - builder.Append(" enableAzureRBAC: "); - var boolValue = IsAzureRbacEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdminGroupObjectIds), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" adminGroupObjectIDs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AdminGroupObjectIds)) - { - if (AdminGroupObjectIds.Any()) - { - builder.Append(" adminGroupObjectIDs: "); - builder.AppendLine("["); - foreach (var item in AdminGroupObjectIds) - { - builder.AppendLine($" '{item.ToString()}'"); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientAppId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" clientAppID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ClientAppId)) - { - builder.Append(" clientAppID: "); - builder.AppendLine($"'{ClientAppId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServerAppId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serverAppID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServerAppId)) - { - builder.Append(" serverAppID: "); - builder.AppendLine($"'{ServerAppId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServerAppSecret), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" serverAppSecret: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ServerAppSecret)) - { - builder.Append(" serverAppSecret: "); - if (ServerAppSecret.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ServerAppSecret}'''"); - } - else - { - builder.AppendLine($"'{ServerAppSecret}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TenantId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" tenantID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TenantId)) - { - builder.Append(" tenantID: "); - builder.AppendLine($"'{TenantId.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(ManagedClusterAadProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAadProfile 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); - return DeserializeManagedClusterAadProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAadProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs deleted file mode 100644 index 1ece50457f5b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAadProfile.cs +++ /dev/null @@ -1,97 +0,0 @@ -// 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 -{ - /// For more details see [managed AAD on AKS](https://docs.microsoft.com/azure/aks/managed-aad). - public partial class ManagedClusterAadProfile - { - /// - /// 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 ManagedClusterAadProfile() - { - AdminGroupObjectIds = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Whether to enable managed AAD. - /// Whether to enable Azure RBAC for Kubernetes authorization. - /// The list of AAD group object IDs that will have admin role of the cluster. - /// (DEPRECATED) The client AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. - /// (DEPRECATED) The server AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. - /// (DEPRECATED) The server AAD application secret. Learn more at https://aka.ms/aks/aad-legacy. - /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAadProfile(bool? isManagedAadEnabled, bool? isAzureRbacEnabled, IList adminGroupObjectIds, Guid? clientAppId, Guid? serverAppId, string serverAppSecret, Guid? tenantId, IDictionary serializedAdditionalRawData) - { - IsManagedAadEnabled = isManagedAadEnabled; - IsAzureRbacEnabled = isAzureRbacEnabled; - AdminGroupObjectIds = adminGroupObjectIds; - ClientAppId = clientAppId; - ServerAppId = serverAppId; - ServerAppSecret = serverAppSecret; - TenantId = tenantId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable managed AAD. - [WirePath("managed")] - public bool? IsManagedAadEnabled { get; set; } - /// Whether to enable Azure RBAC for Kubernetes authorization. - [WirePath("enableAzureRBAC")] - public bool? IsAzureRbacEnabled { get; set; } - /// The list of AAD group object IDs that will have admin role of the cluster. - [WirePath("adminGroupObjectIDs")] - public IList AdminGroupObjectIds { get; } - /// (DEPRECATED) The client AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. - [WirePath("clientAppID")] - public Guid? ClientAppId { get; set; } - /// (DEPRECATED) The server AAD application ID. Learn more at https://aka.ms/aks/aad-legacy. - [WirePath("serverAppID")] - public Guid? ServerAppId { get; set; } - /// (DEPRECATED) The server AAD application secret. Learn more at https://aka.ms/aks/aad-legacy. - [WirePath("serverAppSecret")] - public string ServerAppSecret { get; set; } - /// The AAD tenant ID to use for authentication. If not specified, will use the tenant of the deployment subscription. - [WirePath("tenantID")] - public Guid? TenantId { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs deleted file mode 100644 index 6dbd3041db72..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAccessProfile.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Managed cluster Access Profile. - public partial class ManagedClusterAccessProfile : 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 ManagedClusterAccessProfile(AzureLocation location) : base(location) - { - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The tags. - /// The location. - /// Base64-encoded Kubernetes configuration file. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAccessProfile(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, byte[] kubeConfig, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) - { - KubeConfig = kubeConfig; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterAccessProfile() - { - } - - /// Base64-encoded Kubernetes configuration file. - [WirePath("properties.kubeConfig")] - public byte[] KubeConfig { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs deleted file mode 100644 index b866263c5c57..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.Serialization.cs +++ /dev/null @@ -1,251 +0,0 @@ -// 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 ManagedClusterAddonProfile : 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(ManagedClusterAddonProfile)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled); - if (Optional.IsCollectionDefined(Config)) - { - writer.WritePropertyName("config"u8); - writer.WriteStartObject(); - foreach (var item in Config) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAddonProfile 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(ManagedClusterAddonProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAddonProfile(document.RootElement, options); - } - - internal static ManagedClusterAddonProfile DeserializeManagedClusterAddonProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool enabled = default; - IDictionary config = default; - ManagedClusterAddonProfileIdentity identity = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("enabled"u8)) - { - enabled = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("config"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()); - } - config = dictionary; - continue; - } - if (property.NameEquals("identity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - identity = ManagedClusterAddonProfileIdentity.DeserializeManagedClusterAddonProfileIdentity(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAddonProfile(enabled, config ?? new ChangeTrackingDictionary(), 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enabled: "); - var boolValue = IsEnabled == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Config), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" config: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Config)) - { - if (Config.Any()) - { - builder.Append(" config: "); - builder.AppendLine("{"); - foreach (var item in Config) - { - 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(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(ManagedClusterAddonProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAddonProfile 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); - return DeserializeManagedClusterAddonProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAddonProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs deleted file mode 100644 index 26f4ec81bb01..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfile.cs +++ /dev/null @@ -1,84 +0,0 @@ -// 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 Kubernetes add-on profile for a managed cluster. - public partial class ManagedClusterAddonProfile - { - /// - /// 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 add-on is enabled or not. - public ManagedClusterAddonProfile(bool isEnabled) - { - IsEnabled = isEnabled; - Config = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// Whether the add-on is enabled or not. - /// Key-value pairs for configuring an add-on. - /// Information of user assigned identity used by this add-on. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAddonProfile(bool isEnabled, IDictionary config, ManagedClusterAddonProfileIdentity identity, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - Config = config; - Identity = identity; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterAddonProfile() - { - } - - /// Whether the add-on is enabled or not. - [WirePath("enabled")] - public bool IsEnabled { get; set; } - /// Key-value pairs for configuring an add-on. - [WirePath("config")] - public IDictionary Config { get; } - /// Information of user assigned identity used by this add-on. - [WirePath("identity")] - public ManagedClusterAddonProfileIdentity Identity { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs deleted file mode 100644 index 361fc7545e93..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.Serialization.cs +++ /dev/null @@ -1,197 +0,0 @@ -// 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 ManagedClusterAddonProfileIdentity : 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(ManagedClusterAddonProfileIdentity)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - ManagedClusterAddonProfileIdentity 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(ManagedClusterAddonProfileIdentity)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAddonProfileIdentity(document.RootElement, options); - } - - internal static ManagedClusterAddonProfileIdentity DeserializeManagedClusterAddonProfileIdentity(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier resourceId = default; - Guid? clientId = default; - Guid? objectId = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("resourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - resourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("clientId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - clientId = property.Value.GetGuid(); - continue; - } - if (property.NameEquals("objectId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - objectId = property.Value.GetGuid(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAddonProfileIdentity(resourceId, clientId, objectId, 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(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(ClientId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" clientId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ClientId)) - { - builder.Append(" clientId: "); - builder.AppendLine($"'{ClientId.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ObjectId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" objectId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ObjectId)) - { - builder.Append(" objectId: "); - builder.AppendLine($"'{ObjectId.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(ManagedClusterAddonProfileIdentity)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAddonProfileIdentity 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); - return DeserializeManagedClusterAddonProfileIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAddonProfileIdentity)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs deleted file mode 100644 index 4ce9fa1c8e1d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAddonProfileIdentity.cs +++ /dev/null @@ -1,31 +0,0 @@ -// 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 -{ - /// Information of user assigned identity used by this add-on. - public partial class ManagedClusterAddonProfileIdentity : ContainerServiceUserAssignedIdentity - { - /// Initializes a new instance of . - public ManagedClusterAddonProfileIdentity() - { - } - - /// Initializes a new instance of . - /// The resource ID of the user assigned identity. - /// The client ID of the user assigned identity. - /// The object ID of the user assigned identity. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAddonProfileIdentity(ResourceIdentifier resourceId, Guid? clientId, Guid? objectId, IDictionary serializedAdditionalRawData) : base(resourceId, clientId, objectId, serializedAdditionalRawData) - { - } - } -} 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 deleted file mode 100644 index 5f75761cd221..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.Serialization.cs +++ /dev/null @@ -1,1411 +0,0 @@ -// 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 ManagedClusterAgentPoolProfile : 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(ManagedClusterAgentPoolProfile)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - - ManagedClusterAgentPoolProfile 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(ManagedClusterAgentPoolProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAgentPoolProfile(document.RootElement, options); - } - - internal static ManagedClusterAgentPoolProfile DeserializeManagedClusterAgentPoolProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - int? count = default; - string vmSize = default; - int? osDiskSizeGB = default; - ContainerServiceOSDiskType? osDiskType = default; - KubeletDiskType? kubeletDiskType = default; - WorkloadRuntime? workloadRuntime = default; - ResourceIdentifier vnetSubnetId = default; - ResourceIdentifier podSubnetId = default; - int? maxPods = default; - ContainerServiceOSType? osType = default; - ContainerServiceOSSku? osSku = default; - int? maxCount = default; - int? minCount = default; - bool? enableAutoScaling = default; - ScaleDownMode? scaleDownMode = default; - AgentPoolType? type = default; - AgentPoolMode? mode = default; - string orchestratorVersion = default; - string currentOrchestratorVersion = default; - string nodeImageVersion = default; - AgentPoolUpgradeSettings upgradeSettings = default; - string provisioningState = default; - ContainerServicePowerState powerState = default; - IList availabilityZones = default; - bool? enableNodePublicIP = default; - ResourceIdentifier nodePublicIPPrefixId = default; - ScaleSetPriority? scaleSetPriority = default; - ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; - float? spotMaxPrice = default; - IDictionary tags = default; - IDictionary nodeLabels = default; - IList nodeTaints = default; - ResourceIdentifier proximityPlacementGroupId = default; - KubeletConfig kubeletConfig = default; - LinuxOSConfig linuxOSConfig = default; - bool? enableEncryptionAtHost = default; - bool? enableUltraSsd = default; - bool? enableFIPS = default; - GpuInstanceProfile? gpuInstanceProfile = default; - ContainerServiceCreationData creationData = default; - ResourceIdentifier capacityReservationGroupId = default; - ResourceIdentifier hostGroupId = default; - AgentPoolNetworkProfile networkProfile = 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("count"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("vmSize"u8)) - { - vmSize = property.Value.GetString(); - continue; - } - if (property.NameEquals("osDiskSizeGB"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskSizeGB = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("osDiskType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskType = new ContainerServiceOSDiskType(property.Value.GetString()); - continue; - } - if (property.NameEquals("kubeletDiskType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletDiskType = new KubeletDiskType(property.Value.GetString()); - continue; - } - if (property.NameEquals("workloadRuntime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - workloadRuntime = new WorkloadRuntime(property.Value.GetString()); - continue; - } - if (property.NameEquals("vnetSubnetID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vnetSubnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("podSubnetID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - podSubnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("maxPods"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxPods = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("osType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osType = new ContainerServiceOSType(property.Value.GetString()); - continue; - } - if (property.NameEquals("osSKU"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osSku = new ContainerServiceOSSku(property.Value.GetString()); - continue; - } - if (property.NameEquals("maxCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("enableAutoScaling"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableAutoScaling = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("scaleDownMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleDownMode = new ScaleDownMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new AgentPoolType(property.Value.GetString()); - continue; - } - if (property.NameEquals("mode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mode = new AgentPoolMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("orchestratorVersion"u8)) - { - orchestratorVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("currentOrchestratorVersion"u8)) - { - currentOrchestratorVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("nodeImageVersion"u8)) - { - nodeImageVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("upgradeSettings"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - upgradeSettings = AgentPoolUpgradeSettings.DeserializeAgentPoolUpgradeSettings(property.Value, options); - continue; - } - if (property.NameEquals("provisioningState"u8)) - { - provisioningState = property.Value.GetString(); - continue; - } - if (property.NameEquals("powerState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - powerState = ContainerServicePowerState.DeserializeContainerServicePowerState(property.Value, options); - continue; - } - if (property.NameEquals("availabilityZones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - availabilityZones = array; - continue; - } - if (property.NameEquals("enableNodePublicIP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNodePublicIP = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("nodePublicIPPrefixID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nodePublicIPPrefixId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("scaleSetPriority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetPriority = new ScaleSetPriority(property.Value.GetString()); - continue; - } - if (property.NameEquals("scaleSetEvictionPolicy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetEvictionPolicy = new ScaleSetEvictionPolicy(property.Value.GetString()); - continue; - } - if (property.NameEquals("spotMaxPrice"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - spotMaxPrice = property.Value.GetSingle(); - 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("nodeLabels"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()); - } - nodeLabels = dictionary; - continue; - } - if (property.NameEquals("nodeTaints"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - nodeTaints = array; - continue; - } - if (property.NameEquals("proximityPlacementGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - proximityPlacementGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kubeletConfig"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletConfig = KubeletConfig.DeserializeKubeletConfig(property.Value, options); - continue; - } - if (property.NameEquals("linuxOSConfig"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linuxOSConfig = LinuxOSConfig.DeserializeLinuxOSConfig(property.Value, options); - continue; - } - if (property.NameEquals("enableEncryptionAtHost"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableEncryptionAtHost = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableUltraSSD"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableUltraSsd = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableFIPS"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableFIPS = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("gpuInstanceProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gpuInstanceProfile = new GpuInstanceProfile(property.Value.GetString()); - continue; - } - if (property.NameEquals("creationData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationData = ContainerServiceCreationData.DeserializeContainerServiceCreationData(property.Value, options); - continue; - } - if (property.NameEquals("capacityReservationGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityReservationGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("hostGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hostGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("networkProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAgentPoolProfile( - count, - vmSize, - osDiskSizeGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - type, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, - provisioningState, - powerState, - availabilityZones ?? new ChangeTrackingList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags ?? new ChangeTrackingDictionary(), - nodeLabels ?? new ChangeTrackingDictionary(), - nodeTaints ?? new ChangeTrackingList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFIPS, - gpuInstanceProfile, - creationData, - capacityReservationGroupId, - hostGroupId, - networkProfile, - serializedAdditionalRawData, - name); - } - - 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(Count), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Count)) - { - builder.Append(" count: "); - builder.AppendLine($"{Count.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSize), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmSize: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmSize)) - { - builder.Append(" vmSize: "); - if (VmSize.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{VmSize}'''"); - } - else - { - builder.AppendLine($"'{VmSize}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskSizeInGB), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskSizeInGB)) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine($"{OSDiskSizeInGB.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskType)) - { - builder.Append(" osDiskType: "); - builder.AppendLine($"'{OSDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletDiskType)) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine($"'{KubeletDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WorkloadRuntime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(WorkloadRuntime)) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine($"'{WorkloadRuntime.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VnetSubnetId)) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine($"'{VnetSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodSubnetId)) - { - builder.Append(" podSubnetID: "); - builder.AppendLine($"'{PodSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxPods: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxPods)) - { - builder.Append(" maxPods: "); - builder.AppendLine($"{MaxPods.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSType)) - { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSSku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osSKU: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSSku)) - { - builder.Append(" osSKU: "); - builder.AppendLine($"'{OSSku.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxCount)) - { - builder.Append(" maxCount: "); - builder.AppendLine($"{MaxCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" minCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MinCount)) - { - builder.Append(" minCount: "); - builder.AppendLine($"{MinCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableAutoScaling), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableAutoScaling: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableAutoScaling)) - { - builder.Append(" enableAutoScaling: "); - var boolValue = EnableAutoScaling.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownMode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownMode)) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine($"'{ScaleDownMode.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentPoolType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" type: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AgentPoolType)) - { - builder.Append(" type: "); - builder.AppendLine($"'{AgentPoolType.Value.ToString()}'"); - } - } - - 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(OrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" orchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OrchestratorVersion)) - { - builder.Append(" orchestratorVersion: "); - if (OrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{OrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurrentOrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" currentOrchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CurrentOrchestratorVersion)) - { - builder.Append(" currentOrchestratorVersion: "); - if (CurrentOrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CurrentOrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{CurrentOrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeImageVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeImageVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeImageVersion)) - { - builder.Append(" nodeImageVersion: "); - if (NodeImageVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NodeImageVersion}'''"); - } - else - { - builder.AppendLine($"'{NodeImageVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeSettings), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgradeSettings: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UpgradeSettings)) - { - builder.Append(" upgradeSettings: "); - BicepSerializationHelpers.AppendChildObject(builder, UpgradeSettings, options, 2, false, " upgradeSettings: "); - } - } - - 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}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PowerStateCode", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" powerState: "); - builder.AppendLine("{"); - builder.Append(" code: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PowerState)) - { - builder.Append(" powerState: "); - BicepSerializationHelpers.AppendChildObject(builder, PowerState, options, 2, false, " powerState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailabilityZones), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" availabilityZones: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AvailabilityZones)) - { - if (AvailabilityZones.Any()) - { - builder.Append(" availabilityZones: "); - builder.AppendLine("["); - foreach (var item in AvailabilityZones) - { - 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(EnableNodePublicIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableNodePublicIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableNodePublicIP)) - { - builder.Append(" enableNodePublicIP: "); - var boolValue = EnableNodePublicIP.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodePublicIPPrefixId)) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine($"'{NodePublicIPPrefixId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetPriority), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetPriority)) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine($"'{ScaleSetPriority.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetEvictionPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetEvictionPolicy)) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine($"'{ScaleSetEvictionPolicy.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SpotMaxPrice), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SpotMaxPrice)) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine($"'{SpotMaxPrice.Value.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(NodeLabels), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeLabels: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeLabels)) - { - if (NodeLabels.Any()) - { - builder.Append(" nodeLabels: "); - builder.AppendLine("{"); - foreach (var item in NodeLabels) - { - 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(NodeTaints), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeTaints: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeTaints)) - { - if (NodeTaints.Any()) - { - builder.Append(" nodeTaints: "); - builder.AppendLine("["); - foreach (var item in NodeTaints) - { - 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) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine($"'{ProximityPlacementGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletConfig)) - { - builder.Append(" kubeletConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, KubeletConfig, options, 2, false, " kubeletConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinuxOSConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linuxOSConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinuxOSConfig)) - { - builder.Append(" linuxOSConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, LinuxOSConfig, options, 2, false, " linuxOSConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableEncryptionAtHost), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableEncryptionAtHost: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableEncryptionAtHost)) - { - builder.Append(" enableEncryptionAtHost: "); - var boolValue = EnableEncryptionAtHost.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableUltraSsd), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableUltraSSD: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableUltraSsd)) - { - builder.Append(" enableUltraSSD: "); - var boolValue = EnableUltraSsd.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFips), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableFIPS: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableFips)) - { - builder.Append(" enableFIPS: "); - var boolValue = EnableFips.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuInstanceProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GpuInstanceProfile)) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine($"'{GpuInstanceProfile.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CreationDataSourceResourceId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" creationData: "); - builder.AppendLine("{"); - builder.Append(" sourceResourceId: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(CreationData)) - { - builder.Append(" creationData: "); - BicepSerializationHelpers.AppendChildObject(builder, CreationData, options, 2, false, " creationData: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CapacityReservationGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CapacityReservationGroupId)) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine($"'{CapacityReservationGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hostGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HostGroupId)) - { - builder.Append(" hostGroupID: "); - builder.AppendLine($"'{HostGroupId.ToString()}'"); - } - } - - 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(ManagedClusterAgentPoolProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAgentPoolProfile 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); - return DeserializeManagedClusterAgentPoolProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAgentPoolProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs deleted file mode 100644 index 5814a5f2d5a7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfile.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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 -{ - /// Profile for the container service agent pool. - public partial class ManagedClusterAgentPoolProfile : ManagedClusterAgentPoolProfileProperties - { - /// Initializes a new instance of . - /// Windows agent pool names must be 6 characters or less. - /// is null. - public ManagedClusterAgentPoolProfile(string name) - { - Argument.AssertNotNull(name, nameof(name)); - - Name = name; - } - - /// 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. - /// 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) - { - Name = name; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterAgentPoolProfile() - { - } - - /// Windows agent pool names must be 6 characters or less. - [WirePath("name")] - public string Name { get; set; } - } -} 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 deleted file mode 100644 index 82c6710a7248..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.Serialization.cs +++ /dev/null @@ -1,1630 +0,0 @@ -// 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 ManagedClusterAgentPoolProfileProperties : 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(ManagedClusterAgentPoolProfileProperties)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } - if (Optional.IsDefined(VmSize)) - { - writer.WritePropertyName("vmSize"u8); - writer.WriteStringValue(VmSize); - } - if (Optional.IsDefined(OSDiskSizeInGB)) - { - writer.WritePropertyName("osDiskSizeGB"u8); - writer.WriteNumberValue(OSDiskSizeInGB.Value); - } - if (Optional.IsDefined(OSDiskType)) - { - writer.WritePropertyName("osDiskType"u8); - writer.WriteStringValue(OSDiskType.Value.ToString()); - } - if (Optional.IsDefined(KubeletDiskType)) - { - writer.WritePropertyName("kubeletDiskType"u8); - writer.WriteStringValue(KubeletDiskType.Value.ToString()); - } - if (Optional.IsDefined(WorkloadRuntime)) - { - writer.WritePropertyName("workloadRuntime"u8); - writer.WriteStringValue(WorkloadRuntime.Value.ToString()); - } - if (Optional.IsDefined(VnetSubnetId)) - { - writer.WritePropertyName("vnetSubnetID"u8); - writer.WriteStringValue(VnetSubnetId); - } - if (Optional.IsDefined(PodSubnetId)) - { - writer.WritePropertyName("podSubnetID"u8); - writer.WriteStringValue(PodSubnetId); - } - if (Optional.IsDefined(MaxPods)) - { - writer.WritePropertyName("maxPods"u8); - writer.WriteNumberValue(MaxPods.Value); - } - if (Optional.IsDefined(OSType)) - { - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType.Value.ToString()); - } - if (Optional.IsDefined(OSSku)) - { - writer.WritePropertyName("osSKU"u8); - writer.WriteStringValue(OSSku.Value.ToString()); - } - if (Optional.IsDefined(MaxCount)) - { - writer.WritePropertyName("maxCount"u8); - writer.WriteNumberValue(MaxCount.Value); - } - if (Optional.IsDefined(MinCount)) - { - writer.WritePropertyName("minCount"u8); - writer.WriteNumberValue(MinCount.Value); - } - if (Optional.IsDefined(EnableAutoScaling)) - { - writer.WritePropertyName("enableAutoScaling"u8); - writer.WriteBooleanValue(EnableAutoScaling.Value); - } - if (Optional.IsDefined(ScaleDownMode)) - { - writer.WritePropertyName("scaleDownMode"u8); - writer.WriteStringValue(ScaleDownMode.Value.ToString()); - } - if (Optional.IsDefined(AgentPoolType)) - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(AgentPoolType.Value.ToString()); - } - if (Optional.IsDefined(Mode)) - { - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.Value.ToString()); - } - if (Optional.IsDefined(OrchestratorVersion)) - { - writer.WritePropertyName("orchestratorVersion"u8); - writer.WriteStringValue(OrchestratorVersion); - } - if (options.Format != "W" && Optional.IsDefined(CurrentOrchestratorVersion)) - { - writer.WritePropertyName("currentOrchestratorVersion"u8); - writer.WriteStringValue(CurrentOrchestratorVersion); - } - if (options.Format != "W" && Optional.IsDefined(NodeImageVersion)) - { - writer.WritePropertyName("nodeImageVersion"u8); - writer.WriteStringValue(NodeImageVersion); - } - if (Optional.IsDefined(UpgradeSettings)) - { - writer.WritePropertyName("upgradeSettings"u8); - writer.WriteObjectValue(UpgradeSettings, options); - } - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (Optional.IsDefined(PowerState)) - { - writer.WritePropertyName("powerState"u8); - writer.WriteObjectValue(PowerState, options); - } - if (Optional.IsCollectionDefined(AvailabilityZones)) - { - writer.WritePropertyName("availabilityZones"u8); - writer.WriteStartArray(); - foreach (var item in AvailabilityZones) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnableNodePublicIP)) - { - writer.WritePropertyName("enableNodePublicIP"u8); - writer.WriteBooleanValue(EnableNodePublicIP.Value); - } - if (Optional.IsDefined(NodePublicIPPrefixId)) - { - writer.WritePropertyName("nodePublicIPPrefixID"u8); - writer.WriteStringValue(NodePublicIPPrefixId); - } - if (Optional.IsDefined(ScaleSetPriority)) - { - writer.WritePropertyName("scaleSetPriority"u8); - writer.WriteStringValue(ScaleSetPriority.Value.ToString()); - } - if (Optional.IsDefined(ScaleSetEvictionPolicy)) - { - writer.WritePropertyName("scaleSetEvictionPolicy"u8); - writer.WriteStringValue(ScaleSetEvictionPolicy.Value.ToString()); - } - if (Optional.IsDefined(SpotMaxPrice)) - { - writer.WritePropertyName("spotMaxPrice"u8); - writer.WriteNumberValue(SpotMaxPrice.Value); - } - if (Optional.IsCollectionDefined(Tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in Tags) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(NodeLabels)) - { - writer.WritePropertyName("nodeLabels"u8); - writer.WriteStartObject(); - foreach (var item in NodeLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(NodeTaints)) - { - writer.WritePropertyName("nodeTaints"u8); - writer.WriteStartArray(); - foreach (var item in NodeTaints) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - writer.WritePropertyName("proximityPlacementGroupID"u8); - writer.WriteStringValue(ProximityPlacementGroupId); - } - if (Optional.IsDefined(KubeletConfig)) - { - writer.WritePropertyName("kubeletConfig"u8); - writer.WriteObjectValue(KubeletConfig, options); - } - if (Optional.IsDefined(LinuxOSConfig)) - { - writer.WritePropertyName("linuxOSConfig"u8); - writer.WriteObjectValue(LinuxOSConfig, options); - } - if (Optional.IsDefined(EnableEncryptionAtHost)) - { - writer.WritePropertyName("enableEncryptionAtHost"u8); - writer.WriteBooleanValue(EnableEncryptionAtHost.Value); - } - if (Optional.IsDefined(EnableUltraSsd)) - { - writer.WritePropertyName("enableUltraSSD"u8); - writer.WriteBooleanValue(EnableUltraSsd.Value); - } - if (Optional.IsDefined(EnableFips)) - { - writer.WritePropertyName("enableFIPS"u8); - writer.WriteBooleanValue(EnableFips.Value); - } - if (Optional.IsDefined(GpuInstanceProfile)) - { - writer.WritePropertyName("gpuInstanceProfile"u8); - writer.WriteStringValue(GpuInstanceProfile.Value.ToString()); - } - if (Optional.IsDefined(CreationData)) - { - writer.WritePropertyName("creationData"u8); - writer.WriteObjectValue(CreationData, options); - } - if (Optional.IsDefined(CapacityReservationGroupId)) - { - writer.WritePropertyName("capacityReservationGroupID"u8); - writer.WriteStringValue(CapacityReservationGroupId); - } - if (Optional.IsDefined(HostGroupId)) - { - writer.WritePropertyName("hostGroupID"u8); - writer.WriteStringValue(HostGroupId); - } - if (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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAgentPoolProfileProperties 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(ManagedClusterAgentPoolProfileProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAgentPoolProfileProperties(document.RootElement, options); - } - - internal static ManagedClusterAgentPoolProfileProperties DeserializeManagedClusterAgentPoolProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? count = default; - string vmSize = default; - int? osDiskSizeGB = default; - ContainerServiceOSDiskType? osDiskType = default; - KubeletDiskType? kubeletDiskType = default; - WorkloadRuntime? workloadRuntime = default; - ResourceIdentifier vnetSubnetId = default; - ResourceIdentifier podSubnetId = default; - int? maxPods = default; - ContainerServiceOSType? osType = default; - ContainerServiceOSSku? osSku = default; - int? maxCount = default; - int? minCount = default; - bool? enableAutoScaling = default; - ScaleDownMode? scaleDownMode = default; - AgentPoolType? type = default; - AgentPoolMode? mode = default; - string orchestratorVersion = default; - string currentOrchestratorVersion = default; - string nodeImageVersion = default; - AgentPoolUpgradeSettings upgradeSettings = default; - string provisioningState = default; - ContainerServicePowerState powerState = default; - IList availabilityZones = default; - bool? enableNodePublicIP = default; - ResourceIdentifier nodePublicIPPrefixId = default; - ScaleSetPriority? scaleSetPriority = default; - ScaleSetEvictionPolicy? scaleSetEvictionPolicy = default; - float? spotMaxPrice = default; - IDictionary tags = default; - IDictionary nodeLabels = default; - IList nodeTaints = default; - ResourceIdentifier proximityPlacementGroupId = default; - KubeletConfig kubeletConfig = default; - LinuxOSConfig linuxOSConfig = default; - bool? enableEncryptionAtHost = default; - bool? enableUltraSsd = default; - bool? enableFIPS = default; - GpuInstanceProfile? gpuInstanceProfile = default; - ContainerServiceCreationData creationData = default; - ResourceIdentifier capacityReservationGroupId = default; - ResourceIdentifier hostGroupId = default; - AgentPoolNetworkProfile networkProfile = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("count"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("vmSize"u8)) - { - vmSize = property.Value.GetString(); - continue; - } - if (property.NameEquals("osDiskSizeGB"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskSizeGB = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("osDiskType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osDiskType = new ContainerServiceOSDiskType(property.Value.GetString()); - continue; - } - if (property.NameEquals("kubeletDiskType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletDiskType = new KubeletDiskType(property.Value.GetString()); - continue; - } - if (property.NameEquals("workloadRuntime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - workloadRuntime = new WorkloadRuntime(property.Value.GetString()); - continue; - } - if (property.NameEquals("vnetSubnetID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vnetSubnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("podSubnetID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - podSubnetId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("maxPods"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxPods = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("osType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osType = new ContainerServiceOSType(property.Value.GetString()); - continue; - } - if (property.NameEquals("osSKU"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - osSku = new ContainerServiceOSSku(property.Value.GetString()); - continue; - } - if (property.NameEquals("maxCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - maxCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("minCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - minCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("enableAutoScaling"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableAutoScaling = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("scaleDownMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleDownMode = new ScaleDownMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("type"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - type = new AgentPoolType(property.Value.GetString()); - continue; - } - if (property.NameEquals("mode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - mode = new AgentPoolMode(property.Value.GetString()); - continue; - } - if (property.NameEquals("orchestratorVersion"u8)) - { - orchestratorVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("currentOrchestratorVersion"u8)) - { - currentOrchestratorVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("nodeImageVersion"u8)) - { - nodeImageVersion = property.Value.GetString(); - continue; - } - if (property.NameEquals("upgradeSettings"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - upgradeSettings = AgentPoolUpgradeSettings.DeserializeAgentPoolUpgradeSettings(property.Value, options); - continue; - } - if (property.NameEquals("provisioningState"u8)) - { - provisioningState = property.Value.GetString(); - continue; - } - if (property.NameEquals("powerState"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - powerState = ContainerServicePowerState.DeserializeContainerServicePowerState(property.Value, options); - continue; - } - if (property.NameEquals("availabilityZones"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - availabilityZones = array; - continue; - } - if (property.NameEquals("enableNodePublicIP"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableNodePublicIP = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("nodePublicIPPrefixID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nodePublicIPPrefixId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("scaleSetPriority"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetPriority = new ScaleSetPriority(property.Value.GetString()); - continue; - } - if (property.NameEquals("scaleSetEvictionPolicy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scaleSetEvictionPolicy = new ScaleSetEvictionPolicy(property.Value.GetString()); - continue; - } - if (property.NameEquals("spotMaxPrice"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - spotMaxPrice = property.Value.GetSingle(); - 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("nodeLabels"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()); - } - nodeLabels = dictionary; - continue; - } - if (property.NameEquals("nodeTaints"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - nodeTaints = array; - continue; - } - if (property.NameEquals("proximityPlacementGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - proximityPlacementGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("kubeletConfig"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeletConfig = KubeletConfig.DeserializeKubeletConfig(property.Value, options); - continue; - } - if (property.NameEquals("linuxOSConfig"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - linuxOSConfig = LinuxOSConfig.DeserializeLinuxOSConfig(property.Value, options); - continue; - } - if (property.NameEquals("enableEncryptionAtHost"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableEncryptionAtHost = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableUltraSSD"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableUltraSsd = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("enableFIPS"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableFIPS = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("gpuInstanceProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gpuInstanceProfile = new GpuInstanceProfile(property.Value.GetString()); - continue; - } - if (property.NameEquals("creationData"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - creationData = ContainerServiceCreationData.DeserializeContainerServiceCreationData(property.Value, options); - continue; - } - if (property.NameEquals("capacityReservationGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - capacityReservationGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("hostGroupID"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - hostGroupId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("networkProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - networkProfile = AgentPoolNetworkProfile.DeserializeAgentPoolNetworkProfile(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAgentPoolProfileProperties( - count, - vmSize, - osDiskSizeGB, - osDiskType, - kubeletDiskType, - workloadRuntime, - vnetSubnetId, - podSubnetId, - maxPods, - osType, - osSku, - maxCount, - minCount, - enableAutoScaling, - scaleDownMode, - type, - mode, - orchestratorVersion, - currentOrchestratorVersion, - nodeImageVersion, - upgradeSettings, - provisioningState, - powerState, - availabilityZones ?? new ChangeTrackingList(), - enableNodePublicIP, - nodePublicIPPrefixId, - scaleSetPriority, - scaleSetEvictionPolicy, - spotMaxPrice, - tags ?? new ChangeTrackingDictionary(), - nodeLabels ?? new ChangeTrackingDictionary(), - nodeTaints ?? new ChangeTrackingList(), - proximityPlacementGroupId, - kubeletConfig, - linuxOSConfig, - enableEncryptionAtHost, - enableUltraSsd, - enableFIPS, - gpuInstanceProfile, - creationData, - capacityReservationGroupId, - hostGroupId, - 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(Count), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Count)) - { - builder.Append(" count: "); - builder.AppendLine($"{Count.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSize), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmSize: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmSize)) - { - builder.Append(" vmSize: "); - if (VmSize.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{VmSize}'''"); - } - else - { - builder.AppendLine($"'{VmSize}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskSizeInGB), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskSizeInGB)) - { - builder.Append(" osDiskSizeGB: "); - builder.AppendLine($"{OSDiskSizeInGB.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSDiskType)) - { - builder.Append(" osDiskType: "); - builder.AppendLine($"'{OSDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletDiskType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletDiskType)) - { - builder.Append(" kubeletDiskType: "); - builder.AppendLine($"'{KubeletDiskType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WorkloadRuntime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(WorkloadRuntime)) - { - builder.Append(" workloadRuntime: "); - builder.AppendLine($"'{WorkloadRuntime.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VnetSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VnetSubnetId)) - { - builder.Append(" vnetSubnetID: "); - builder.AppendLine($"'{VnetSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PodSubnetId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podSubnetID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PodSubnetId)) - { - builder.Append(" podSubnetID: "); - builder.AppendLine($"'{PodSubnetId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxPods), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxPods: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxPods)) - { - builder.Append(" maxPods: "); - builder.AppendLine($"{MaxPods.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSType)) - { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSSku), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osSKU: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OSSku)) - { - builder.Append(" osSKU: "); - builder.AppendLine($"'{OSSku.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" maxCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxCount)) - { - builder.Append(" maxCount: "); - builder.AppendLine($"{MaxCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" minCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MinCount)) - { - builder.Append(" minCount: "); - builder.AppendLine($"{MinCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableAutoScaling), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableAutoScaling: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableAutoScaling)) - { - builder.Append(" enableAutoScaling: "); - var boolValue = EnableAutoScaling.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownMode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownMode)) - { - builder.Append(" scaleDownMode: "); - builder.AppendLine($"'{ScaleDownMode.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AgentPoolType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" type: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AgentPoolType)) - { - builder.Append(" type: "); - builder.AppendLine($"'{AgentPoolType.Value.ToString()}'"); - } - } - - 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(OrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" orchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OrchestratorVersion)) - { - builder.Append(" orchestratorVersion: "); - if (OrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{OrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CurrentOrchestratorVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" currentOrchestratorVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CurrentOrchestratorVersion)) - { - builder.Append(" currentOrchestratorVersion: "); - if (CurrentOrchestratorVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{CurrentOrchestratorVersion}'''"); - } - else - { - builder.AppendLine($"'{CurrentOrchestratorVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeImageVersion), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeImageVersion: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeImageVersion)) - { - builder.Append(" nodeImageVersion: "); - if (NodeImageVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NodeImageVersion}'''"); - } - else - { - builder.AppendLine($"'{NodeImageVersion}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeSettings), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgradeSettings: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UpgradeSettings)) - { - builder.Append(" upgradeSettings: "); - BicepSerializationHelpers.AppendChildObject(builder, UpgradeSettings, options, 2, false, " upgradeSettings: "); - } - } - - 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}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("PowerStateCode", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" powerState: "); - builder.AppendLine("{"); - builder.Append(" code: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(PowerState)) - { - builder.Append(" powerState: "); - BicepSerializationHelpers.AppendChildObject(builder, PowerState, options, 2, false, " powerState: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailabilityZones), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" availabilityZones: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AvailabilityZones)) - { - if (AvailabilityZones.Any()) - { - builder.Append(" availabilityZones: "); - builder.AppendLine("["); - foreach (var item in AvailabilityZones) - { - 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(EnableNodePublicIP), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableNodePublicIP: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableNodePublicIP)) - { - builder.Append(" enableNodePublicIP: "); - var boolValue = EnableNodePublicIP.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodePublicIPPrefixId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodePublicIPPrefixId)) - { - builder.Append(" nodePublicIPPrefixID: "); - builder.AppendLine($"'{NodePublicIPPrefixId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetPriority), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetPriority)) - { - builder.Append(" scaleSetPriority: "); - builder.AppendLine($"'{ScaleSetPriority.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleSetEvictionPolicy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleSetEvictionPolicy)) - { - builder.Append(" scaleSetEvictionPolicy: "); - builder.AppendLine($"'{ScaleSetEvictionPolicy.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SpotMaxPrice), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SpotMaxPrice)) - { - builder.Append(" spotMaxPrice: "); - builder.AppendLine($"'{SpotMaxPrice.Value.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(NodeLabels), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeLabels: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeLabels)) - { - if (NodeLabels.Any()) - { - builder.Append(" nodeLabels: "); - builder.AppendLine("{"); - foreach (var item in NodeLabels) - { - 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(NodeTaints), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeTaints: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NodeTaints)) - { - if (NodeTaints.Any()) - { - builder.Append(" nodeTaints: "); - builder.AppendLine("["); - foreach (var item in NodeTaints) - { - 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) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ProximityPlacementGroupId)) - { - builder.Append(" proximityPlacementGroupID: "); - builder.AppendLine($"'{ProximityPlacementGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeletConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeletConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeletConfig)) - { - builder.Append(" kubeletConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, KubeletConfig, options, 2, false, " kubeletConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinuxOSConfig), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" linuxOSConfig: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LinuxOSConfig)) - { - builder.Append(" linuxOSConfig: "); - BicepSerializationHelpers.AppendChildObject(builder, LinuxOSConfig, options, 2, false, " linuxOSConfig: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableEncryptionAtHost), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableEncryptionAtHost: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableEncryptionAtHost)) - { - builder.Append(" enableEncryptionAtHost: "); - var boolValue = EnableEncryptionAtHost.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableUltraSsd), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableUltraSSD: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableUltraSsd)) - { - builder.Append(" enableUltraSSD: "); - var boolValue = EnableUltraSsd.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableFips), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableFIPS: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableFips)) - { - builder.Append(" enableFIPS: "); - var boolValue = EnableFips.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GpuInstanceProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GpuInstanceProfile)) - { - builder.Append(" gpuInstanceProfile: "); - builder.AppendLine($"'{GpuInstanceProfile.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("CreationDataSourceResourceId", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" creationData: "); - builder.AppendLine("{"); - builder.Append(" sourceResourceId: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(CreationData)) - { - builder.Append(" creationData: "); - BicepSerializationHelpers.AppendChildObject(builder, CreationData, options, 2, false, " creationData: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CapacityReservationGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CapacityReservationGroupId)) - { - builder.Append(" capacityReservationGroupID: "); - builder.AppendLine($"'{CapacityReservationGroupId.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HostGroupId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" hostGroupID: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HostGroupId)) - { - builder.Append(" hostGroupID: "); - builder.AppendLine($"'{HostGroupId.ToString()}'"); - } - } - - 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(ManagedClusterAgentPoolProfileProperties)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAgentPoolProfileProperties 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); - return DeserializeManagedClusterAgentPoolProfileProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAgentPoolProfileProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs deleted file mode 100644 index b23edbb4a140..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAgentPoolProfileProperties.cs +++ /dev/null @@ -1,305 +0,0 @@ -// 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 -{ - /// Properties for the container service agent pool profile. - public partial class ManagedClusterAgentPoolProfileProperties - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public ManagedClusterAgentPoolProfileProperties() - { - AvailabilityZones = new ChangeTrackingList(); - Tags = new ChangeTrackingDictionary(); - NodeLabels = new ChangeTrackingDictionary(); - NodeTaints = new ChangeTrackingList(); - } - - /// 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. - /// 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) - { - Count = count; - VmSize = vmSize; - OSDiskSizeInGB = osDiskSizeInGB; - OSDiskType = osDiskType; - KubeletDiskType = kubeletDiskType; - WorkloadRuntime = workloadRuntime; - VnetSubnetId = vnetSubnetId; - PodSubnetId = podSubnetId; - 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; - PowerState = powerState; - AvailabilityZones = availabilityZones; - EnableNodePublicIP = enableNodePublicIP; - NodePublicIPPrefixId = nodePublicIPPrefixId; - ScaleSetPriority = scaleSetPriority; - ScaleSetEvictionPolicy = scaleSetEvictionPolicy; - SpotMaxPrice = spotMaxPrice; - Tags = tags; - NodeLabels = nodeLabels; - NodeTaints = nodeTaints; - ProximityPlacementGroupId = proximityPlacementGroupId; - KubeletConfig = kubeletConfig; - LinuxOSConfig = linuxOSConfig; - EnableEncryptionAtHost = enableEncryptionAtHost; - EnableUltraSsd = enableUltraSsd; - EnableFips = enableFips; - GpuInstanceProfile = gpuInstanceProfile; - CreationData = creationData; - CapacityReservationGroupId = capacityReservationGroupId; - HostGroupId = hostGroupId; - NetworkProfile = networkProfile; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// 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; } - /// 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. - [WirePath("vmSize")] - public string VmSize { get; set; } - /// 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. - [WirePath("osDiskSizeGB")] - public int? OSDiskSizeInGB { get; set; } - /// 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). - [WirePath("osDiskType")] - public ContainerServiceOSDiskType? OSDiskType { get; set; } - /// Determines the placement of emptyDir volumes, container runtime data root, and Kubelet ephemeral storage. - [WirePath("kubeletDiskType")] - public KubeletDiskType? KubeletDiskType { get; set; } - /// Determines the type of workload a node can run. - [WirePath("workloadRuntime")] - public WorkloadRuntime? WorkloadRuntime { 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 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. - [WirePath("osSKU")] - public ContainerServiceOSSku? OSSku { get; set; } - /// The maximum number of nodes for auto-scaling. - [WirePath("maxCount")] - public int? MaxCount { get; set; } - /// The minimum number of nodes for auto-scaling. - [WirePath("minCount")] - public int? MinCount { get; set; } - /// Whether to enable auto-scaler. - [WirePath("enableAutoScaling")] - public bool? EnableAutoScaling { get; set; } - /// This also effects the cluster autoscaler behavior. If not specified, it defaults to Delete. - [WirePath("scaleDownMode")] - public ScaleDownMode? ScaleDownMode { get; set; } - /// The type of Agent Pool. - [WirePath("type")] - public AgentPoolType? AgentPoolType { get; set; } - /// 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). - [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. - [WirePath("currentOrchestratorVersion")] - public string CurrentOrchestratorVersion { get; } - /// The version of node image. - [WirePath("nodeImageVersion")] - public string NodeImageVersion { get; } - /// Settings for upgrading the agentpool. - [WirePath("upgradeSettings")] - public AgentPoolUpgradeSettings UpgradeSettings { get; set; } - /// The current deployment or provisioning state. - [WirePath("provisioningState")] - public string ProvisioningState { get; } - /// 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. - internal ContainerServicePowerState PowerState { get; set; } - /// Tells whether the cluster is Running or Stopped. - [WirePath("powerState.code")] - public ContainerServiceStateCode? PowerStateCode - { - get => PowerState is null ? default : PowerState.Code; - set - { - if (PowerState is null) - PowerState = new ContainerServicePowerState(); - PowerState.Code = value; - } - } - - /// The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. - [WirePath("availabilityZones")] - public IList AvailabilityZones { get; } - /// 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; } - /// This is of the form: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/publicIPPrefixes/{publicIPPrefixName}. - [WirePath("nodePublicIPPrefixID")] - public ResourceIdentifier NodePublicIPPrefixId { get; set; } - /// The Virtual Machine Scale Set priority. If not specified, the default is 'Regular'. - [WirePath("scaleSetPriority")] - public ScaleSetPriority? ScaleSetPriority { get; set; } - /// This cannot be specified unless the scaleSetPriority is 'Spot'. If not specified, the default is 'Delete'. - [WirePath("scaleSetEvictionPolicy")] - public ScaleSetEvictionPolicy? ScaleSetEvictionPolicy { get; set; } - /// 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). - [WirePath("spotMaxPrice")] - public float? SpotMaxPrice { get; set; } - /// The tags to be persisted on the agent pool virtual machine scale set. - [WirePath("tags")] - public IDictionary Tags { get; } - /// The node labels to be persisted across all nodes in agent pool. - [WirePath("nodeLabels")] - public IDictionary NodeLabels { get; } - /// The taints added to new nodes during node pool create and scale. For example, key=value:NoSchedule. - [WirePath("nodeTaints")] - public IList NodeTaints { get; } - /// The ID for Proximity Placement Group. - [WirePath("proximityPlacementGroupID")] - public ResourceIdentifier ProximityPlacementGroupId { get; set; } - /// The Kubelet configuration on the agent pool nodes. - [WirePath("kubeletConfig")] - public KubeletConfig KubeletConfig { get; set; } - /// The OS configuration of Linux agent nodes. - [WirePath("linuxOSConfig")] - public LinuxOSConfig LinuxOSConfig { get; set; } - /// 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. - [WirePath("enableEncryptionAtHost")] - public bool? EnableEncryptionAtHost { get; set; } - /// Whether to enable UltraSSD. - [WirePath("enableUltraSSD")] - public bool? EnableUltraSsd { get; set; } - /// 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. - [WirePath("enableFIPS")] - public bool? EnableFips { get; set; } - /// GPUInstanceProfile to be used to specify GPU MIG instance profile for supported GPU VM SKU. - [WirePath("gpuInstanceProfile")] - public GpuInstanceProfile? GpuInstanceProfile { get; set; } - /// CreationData to be used to specify the source Snapshot ID if the node pool 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("creationData.sourceResourceId")] - public ResourceIdentifier CreationDataSourceResourceId - { - get => CreationData is null ? default : CreationData.SourceResourceId; - set - { - if (CreationData is null) - CreationData = new ContainerServiceCreationData(); - CreationData.SourceResourceId = value; - } - } - - /// AKS will associate the specified agent pool with the Capacity Reservation Group. - [WirePath("capacityReservationGroupID")] - public ResourceIdentifier CapacityReservationGroupId { get; set; } - /// 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; } - /// Network-related settings of an agent pool. - [WirePath("networkProfile")] - public AgentPoolNetworkProfile NetworkProfile { 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 deleted file mode 100644 index 9fe08827650d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.Serialization.cs +++ /dev/null @@ -1,331 +0,0 @@ -// 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 ManagedClusterApiServerAccessProfile : 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(ManagedClusterApiServerAccessProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(AuthorizedIPRanges)) - { - writer.WritePropertyName("authorizedIPRanges"u8); - writer.WriteStartArray(); - foreach (var item in AuthorizedIPRanges) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(EnablePrivateCluster)) - { - writer.WritePropertyName("enablePrivateCluster"u8); - writer.WriteBooleanValue(EnablePrivateCluster.Value); - } - if (Optional.IsDefined(PrivateDnsZone)) - { - writer.WritePropertyName("privateDNSZone"u8); - writer.WriteStringValue(PrivateDnsZone); - } - if (Optional.IsDefined(EnablePrivateClusterPublicFqdn)) - { - writer.WritePropertyName("enablePrivateClusterPublicFQDN"u8); - writer.WriteBooleanValue(EnablePrivateClusterPublicFqdn.Value); - } - if (Optional.IsDefined(DisableRunCommand)) - { - writer.WritePropertyName("disableRunCommand"u8); - writer.WriteBooleanValue(DisableRunCommand.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterApiServerAccessProfile 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(ManagedClusterApiServerAccessProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterApiServerAccessProfile(document.RootElement, options); - } - - internal static ManagedClusterApiServerAccessProfile DeserializeManagedClusterApiServerAccessProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList authorizedIPRanges = default; - bool? enablePrivateCluster = default; - string privateDnsZone = default; - bool? enablePrivateClusterPublicFQDN = default; - bool? disableRunCommand = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("authorizedIPRanges"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - authorizedIPRanges = array; - continue; - } - if (property.NameEquals("enablePrivateCluster"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enablePrivateCluster = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("privateDNSZone"u8)) - { - privateDnsZone = property.Value.GetString(); - continue; - } - if (property.NameEquals("enablePrivateClusterPublicFQDN"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enablePrivateClusterPublicFQDN = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("disableRunCommand"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - disableRunCommand = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterApiServerAccessProfile( - authorizedIPRanges ?? new ChangeTrackingList(), - enablePrivateCluster, - privateDnsZone, - enablePrivateClusterPublicFQDN, - disableRunCommand, - 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(AuthorizedIPRanges), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" authorizedIPRanges: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(AuthorizedIPRanges)) - { - if (AuthorizedIPRanges.Any()) - { - builder.Append(" authorizedIPRanges: "); - builder.AppendLine("["); - foreach (var item in AuthorizedIPRanges) - { - 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(EnablePrivateCluster), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enablePrivateCluster: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnablePrivateCluster)) - { - builder.Append(" enablePrivateCluster: "); - var boolValue = EnablePrivateCluster.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrivateDnsZone), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" privateDNSZone: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(PrivateDnsZone)) - { - builder.Append(" privateDNSZone: "); - if (PrivateDnsZone.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrivateDnsZone}'''"); - } - else - { - builder.AppendLine($"'{PrivateDnsZone}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnablePrivateClusterPublicFqdn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enablePrivateClusterPublicFQDN: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnablePrivateClusterPublicFqdn)) - { - builder.Append(" enablePrivateClusterPublicFQDN: "); - var boolValue = EnablePrivateClusterPublicFqdn.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisableRunCommand), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" disableRunCommand: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DisableRunCommand)) - { - builder.Append(" disableRunCommand: "); - var boolValue = DisableRunCommand.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(ManagedClusterApiServerAccessProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterApiServerAccessProfile 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); - return DeserializeManagedClusterApiServerAccessProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterApiServerAccessProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs deleted file mode 100644 index 915054a6d67f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterApiServerAccessProfile.cs +++ /dev/null @@ -1,87 +0,0 @@ -// 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 -{ - /// Access profile for managed cluster API server. - public partial class ManagedClusterApiServerAccessProfile - { - /// - /// 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 ManagedClusterApiServerAccessProfile() - { - AuthorizedIPRanges = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). - /// For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). - /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterApiServerAccessProfile(IList authorizedIPRanges, bool? enablePrivateCluster, string privateDnsZone, bool? enablePrivateClusterPublicFqdn, bool? disableRunCommand, IDictionary serializedAdditionalRawData) - { - AuthorizedIPRanges = authorizedIPRanges; - EnablePrivateCluster = enablePrivateCluster; - PrivateDnsZone = privateDnsZone; - EnablePrivateClusterPublicFqdn = enablePrivateClusterPublicFqdn; - DisableRunCommand = disableRunCommand; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// IP ranges are specified in CIDR format, e.g. 137.117.106.88/29. This feature is not compatible with clusters that use Public IP Per Node, or clusters that are using a Basic Load Balancer. For more information see [API server authorized IP ranges](https://docs.microsoft.com/azure/aks/api-server-authorized-ip-ranges). - [WirePath("authorizedIPRanges")] - public IList AuthorizedIPRanges { get; } - /// For more details, see [Creating a private AKS cluster](https://docs.microsoft.com/azure/aks/private-clusters). - [WirePath("enablePrivateCluster")] - public bool? EnablePrivateCluster { get; set; } - /// 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'. - [WirePath("privateDNSZone")] - public string PrivateDnsZone { get; set; } - /// Whether to create additional public FQDN for private cluster or not. - [WirePath("enablePrivateClusterPublicFQDN")] - public bool? EnablePrivateClusterPublicFqdn { get; set; } - /// Whether to disable run command for the cluster or not. - [WirePath("disableRunCommand")] - public bool? DisableRunCommand { 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 deleted file mode 100644 index 81d43aabcb6c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.Serialization.cs +++ /dev/null @@ -1,728 +0,0 @@ -// 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 ManagedClusterAutoScalerProfile : 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(ManagedClusterAutoScalerProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(BalanceSimilarNodeGroups)) - { - writer.WritePropertyName("balance-similar-node-groups"u8); - writer.WriteStringValue(BalanceSimilarNodeGroups); - } - if (Optional.IsDefined(Expander)) - { - writer.WritePropertyName("expander"u8); - writer.WriteStringValue(Expander.Value.ToString()); - } - if (Optional.IsDefined(MaxEmptyBulkDelete)) - { - writer.WritePropertyName("max-empty-bulk-delete"u8); - writer.WriteStringValue(MaxEmptyBulkDelete); - } - if (Optional.IsDefined(MaxGracefulTerminationSec)) - { - writer.WritePropertyName("max-graceful-termination-sec"u8); - writer.WriteStringValue(MaxGracefulTerminationSec); - } - if (Optional.IsDefined(MaxNodeProvisionTime)) - { - writer.WritePropertyName("max-node-provision-time"u8); - writer.WriteStringValue(MaxNodeProvisionTime); - } - if (Optional.IsDefined(MaxTotalUnreadyPercentage)) - { - writer.WritePropertyName("max-total-unready-percentage"u8); - writer.WriteStringValue(MaxTotalUnreadyPercentage); - } - if (Optional.IsDefined(NewPodScaleUpDelay)) - { - writer.WritePropertyName("new-pod-scale-up-delay"u8); - writer.WriteStringValue(NewPodScaleUpDelay); - } - if (Optional.IsDefined(OkTotalUnreadyCount)) - { - writer.WritePropertyName("ok-total-unready-count"u8); - writer.WriteStringValue(OkTotalUnreadyCount); - } - if (Optional.IsDefined(ScanIntervalInSeconds)) - { - writer.WritePropertyName("scan-interval"u8); - writer.WriteStringValue(ScanIntervalInSeconds); - } - if (Optional.IsDefined(ScaleDownDelayAfterAdd)) - { - writer.WritePropertyName("scale-down-delay-after-add"u8); - writer.WriteStringValue(ScaleDownDelayAfterAdd); - } - if (Optional.IsDefined(ScaleDownDelayAfterDelete)) - { - writer.WritePropertyName("scale-down-delay-after-delete"u8); - writer.WriteStringValue(ScaleDownDelayAfterDelete); - } - if (Optional.IsDefined(ScaleDownDelayAfterFailure)) - { - writer.WritePropertyName("scale-down-delay-after-failure"u8); - writer.WriteStringValue(ScaleDownDelayAfterFailure); - } - if (Optional.IsDefined(ScaleDownUnneededTime)) - { - writer.WritePropertyName("scale-down-unneeded-time"u8); - writer.WriteStringValue(ScaleDownUnneededTime); - } - if (Optional.IsDefined(ScaleDownUnreadyTime)) - { - writer.WritePropertyName("scale-down-unready-time"u8); - writer.WriteStringValue(ScaleDownUnreadyTime); - } - if (Optional.IsDefined(ScaleDownUtilizationThreshold)) - { - writer.WritePropertyName("scale-down-utilization-threshold"u8); - writer.WriteStringValue(ScaleDownUtilizationThreshold); - } - if (Optional.IsDefined(SkipNodesWithLocalStorage)) - { - writer.WritePropertyName("skip-nodes-with-local-storage"u8); - writer.WriteStringValue(SkipNodesWithLocalStorage); - } - if (Optional.IsDefined(SkipNodesWithSystemPods)) - { - writer.WritePropertyName("skip-nodes-with-system-pods"u8); - writer.WriteStringValue(SkipNodesWithSystemPods); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAutoScalerProfile 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(ManagedClusterAutoScalerProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAutoScalerProfile(document.RootElement, options); - } - - internal static ManagedClusterAutoScalerProfile DeserializeManagedClusterAutoScalerProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string balanceSimilarNodeGroups = default; - AutoScaleExpander? expander = default; - string maxEmptyBulkDelete = default; - string maxGracefulTerminationSec = default; - string maxNodeProvisionTime = default; - string maxTotalUnreadyPercentage = default; - string newPodScaleUpDelay = default; - string okTotalUnreadyCount = default; - string scanInterval = default; - string scaleDownDelayAfterAdd = default; - string scaleDownDelayAfterDelete = default; - string scaleDownDelayAfterFailure = default; - string scaleDownUnneededTime = default; - string scaleDownUnreadyTime = default; - string scaleDownUtilizationThreshold = default; - string skipNodesWithLocalStorage = default; - string skipNodesWithSystemPods = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("balance-similar-node-groups"u8)) - { - balanceSimilarNodeGroups = property.Value.GetString(); - continue; - } - if (property.NameEquals("expander"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - expander = new AutoScaleExpander(property.Value.GetString()); - continue; - } - if (property.NameEquals("max-empty-bulk-delete"u8)) - { - maxEmptyBulkDelete = property.Value.GetString(); - continue; - } - if (property.NameEquals("max-graceful-termination-sec"u8)) - { - maxGracefulTerminationSec = property.Value.GetString(); - continue; - } - if (property.NameEquals("max-node-provision-time"u8)) - { - maxNodeProvisionTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("max-total-unready-percentage"u8)) - { - maxTotalUnreadyPercentage = property.Value.GetString(); - continue; - } - if (property.NameEquals("new-pod-scale-up-delay"u8)) - { - newPodScaleUpDelay = property.Value.GetString(); - continue; - } - if (property.NameEquals("ok-total-unready-count"u8)) - { - okTotalUnreadyCount = property.Value.GetString(); - continue; - } - if (property.NameEquals("scan-interval"u8)) - { - scanInterval = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-delay-after-add"u8)) - { - scaleDownDelayAfterAdd = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-delay-after-delete"u8)) - { - scaleDownDelayAfterDelete = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-delay-after-failure"u8)) - { - scaleDownDelayAfterFailure = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-unneeded-time"u8)) - { - scaleDownUnneededTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-unready-time"u8)) - { - scaleDownUnreadyTime = property.Value.GetString(); - continue; - } - if (property.NameEquals("scale-down-utilization-threshold"u8)) - { - scaleDownUtilizationThreshold = property.Value.GetString(); - continue; - } - if (property.NameEquals("skip-nodes-with-local-storage"u8)) - { - skipNodesWithLocalStorage = property.Value.GetString(); - continue; - } - if (property.NameEquals("skip-nodes-with-system-pods"u8)) - { - skipNodesWithSystemPods = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAutoScalerProfile( - balanceSimilarNodeGroups, - expander, - maxEmptyBulkDelete, - maxGracefulTerminationSec, - maxNodeProvisionTime, - maxTotalUnreadyPercentage, - newPodScaleUpDelay, - okTotalUnreadyCount, - scanInterval, - scaleDownDelayAfterAdd, - scaleDownDelayAfterDelete, - scaleDownDelayAfterFailure, - scaleDownUnneededTime, - scaleDownUnreadyTime, - scaleDownUtilizationThreshold, - skipNodesWithLocalStorage, - skipNodesWithSystemPods, - 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(BalanceSimilarNodeGroups), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" balance-similar-node-groups: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(BalanceSimilarNodeGroups)) - { - builder.Append(" balance-similar-node-groups: "); - if (BalanceSimilarNodeGroups.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{BalanceSimilarNodeGroups}'''"); - } - else - { - builder.AppendLine($"'{BalanceSimilarNodeGroups}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Expander), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" expander: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Expander)) - { - builder.Append(" expander: "); - builder.AppendLine($"'{Expander.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxEmptyBulkDelete), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" max-empty-bulk-delete: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxEmptyBulkDelete)) - { - builder.Append(" max-empty-bulk-delete: "); - if (MaxEmptyBulkDelete.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxEmptyBulkDelete}'''"); - } - else - { - builder.AppendLine($"'{MaxEmptyBulkDelete}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxGracefulTerminationSec), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" max-graceful-termination-sec: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxGracefulTerminationSec)) - { - builder.Append(" max-graceful-termination-sec: "); - if (MaxGracefulTerminationSec.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxGracefulTerminationSec}'''"); - } - else - { - builder.AppendLine($"'{MaxGracefulTerminationSec}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxNodeProvisionTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" max-node-provision-time: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxNodeProvisionTime)) - { - builder.Append(" max-node-provision-time: "); - if (MaxNodeProvisionTime.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxNodeProvisionTime}'''"); - } - else - { - builder.AppendLine($"'{MaxNodeProvisionTime}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxTotalUnreadyPercentage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" max-total-unready-percentage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MaxTotalUnreadyPercentage)) - { - builder.Append(" max-total-unready-percentage: "); - if (MaxTotalUnreadyPercentage.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MaxTotalUnreadyPercentage}'''"); - } - else - { - builder.AppendLine($"'{MaxTotalUnreadyPercentage}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NewPodScaleUpDelay), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" new-pod-scale-up-delay: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NewPodScaleUpDelay)) - { - builder.Append(" new-pod-scale-up-delay: "); - if (NewPodScaleUpDelay.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NewPodScaleUpDelay}'''"); - } - else - { - builder.AppendLine($"'{NewPodScaleUpDelay}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OkTotalUnreadyCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" ok-total-unready-count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(OkTotalUnreadyCount)) - { - builder.Append(" ok-total-unready-count: "); - if (OkTotalUnreadyCount.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{OkTotalUnreadyCount}'''"); - } - else - { - builder.AppendLine($"'{OkTotalUnreadyCount}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScanIntervalInSeconds), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scan-interval: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScanIntervalInSeconds)) - { - builder.Append(" scan-interval: "); - if (ScanIntervalInSeconds.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScanIntervalInSeconds}'''"); - } - else - { - builder.AppendLine($"'{ScanIntervalInSeconds}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownDelayAfterAdd), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-delay-after-add: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownDelayAfterAdd)) - { - builder.Append(" scale-down-delay-after-add: "); - if (ScaleDownDelayAfterAdd.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownDelayAfterAdd}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownDelayAfterAdd}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownDelayAfterDelete), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-delay-after-delete: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownDelayAfterDelete)) - { - builder.Append(" scale-down-delay-after-delete: "); - if (ScaleDownDelayAfterDelete.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownDelayAfterDelete}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownDelayAfterDelete}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownDelayAfterFailure), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-delay-after-failure: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownDelayAfterFailure)) - { - builder.Append(" scale-down-delay-after-failure: "); - if (ScaleDownDelayAfterFailure.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownDelayAfterFailure}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownDelayAfterFailure}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownUnneededTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-unneeded-time: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownUnneededTime)) - { - builder.Append(" scale-down-unneeded-time: "); - if (ScaleDownUnneededTime.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownUnneededTime}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownUnneededTime}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownUnreadyTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-unready-time: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownUnreadyTime)) - { - builder.Append(" scale-down-unready-time: "); - if (ScaleDownUnreadyTime.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownUnreadyTime}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownUnreadyTime}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleDownUtilizationThreshold), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" scale-down-utilization-threshold: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ScaleDownUtilizationThreshold)) - { - builder.Append(" scale-down-utilization-threshold: "); - if (ScaleDownUtilizationThreshold.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ScaleDownUtilizationThreshold}'''"); - } - else - { - builder.AppendLine($"'{ScaleDownUtilizationThreshold}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SkipNodesWithLocalStorage), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" skip-nodes-with-local-storage: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SkipNodesWithLocalStorage)) - { - builder.Append(" skip-nodes-with-local-storage: "); - if (SkipNodesWithLocalStorage.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SkipNodesWithLocalStorage}'''"); - } - else - { - builder.AppendLine($"'{SkipNodesWithLocalStorage}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SkipNodesWithSystemPods), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" skip-nodes-with-system-pods: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SkipNodesWithSystemPods)) - { - builder.Append(" skip-nodes-with-system-pods: "); - if (SkipNodesWithSystemPods.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SkipNodesWithSystemPods}'''"); - } - else - { - builder.AppendLine($"'{SkipNodesWithSystemPods}'"); - } - } - } - - 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(ManagedClusterAutoScalerProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAutoScalerProfile 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); - return DeserializeManagedClusterAutoScalerProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAutoScalerProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs deleted file mode 100644 index 4cd1ca0a37ba..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoScalerProfile.cs +++ /dev/null @@ -1,146 +0,0 @@ -// 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 -{ - /// Parameters to be applied to the cluster-autoscaler when enabled. - public partial class ManagedClusterAutoScalerProfile - { - /// - /// 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 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. - /// 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. - /// The default is 45. The maximum is 100 and the minimum is 0. - /// For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). - /// This must be an integer. The default is 3. - /// The default is '10'. Values must be an integer number of seconds. - /// The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - /// The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - /// The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - /// The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - /// The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - /// The default is '0.5'. - /// 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) - { - BalanceSimilarNodeGroups = balanceSimilarNodeGroups; - Expander = expander; - MaxEmptyBulkDelete = maxEmptyBulkDelete; - MaxGracefulTerminationSec = maxGracefulTerminationSec; - MaxNodeProvisionTime = maxNodeProvisionTime; - MaxTotalUnreadyPercentage = maxTotalUnreadyPercentage; - NewPodScaleUpDelay = newPodScaleUpDelay; - OkTotalUnreadyCount = okTotalUnreadyCount; - ScanIntervalInSeconds = scanIntervalInSeconds; - ScaleDownDelayAfterAdd = scaleDownDelayAfterAdd; - ScaleDownDelayAfterDelete = scaleDownDelayAfterDelete; - ScaleDownDelayAfterFailure = scaleDownDelayAfterFailure; - ScaleDownUnneededTime = scaleDownUnneededTime; - ScaleDownUnreadyTime = scaleDownUnreadyTime; - ScaleDownUtilizationThreshold = scaleDownUtilizationThreshold; - SkipNodesWithLocalStorage = skipNodesWithLocalStorage; - SkipNodesWithSystemPods = skipNodesWithSystemPods; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// 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. - [WirePath("expander")] - public AutoScaleExpander? Expander { get; set; } - /// The default is 10. - [WirePath("max-empty-bulk-delete")] - public string MaxEmptyBulkDelete { get; set; } - /// The default is 600. - [WirePath("max-graceful-termination-sec")] - public string MaxGracefulTerminationSec { get; set; } - /// The default is '15m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("max-node-provision-time")] - public string MaxNodeProvisionTime { get; set; } - /// The default is 45. The maximum is 100 and the minimum is 0. - [WirePath("max-total-unready-percentage")] - public string MaxTotalUnreadyPercentage { get; set; } - /// For scenarios like burst/batch scale where you don't want CA to act before the kubernetes scheduler could schedule all the pods, you can tell CA to ignore unscheduled pods before they're a certain age. The default is '0s'. Values must be an integer followed by a unit ('s' for seconds, 'm' for minutes, 'h' for hours, etc). - [WirePath("new-pod-scale-up-delay")] - public string NewPodScaleUpDelay { get; set; } - /// This must be an integer. The default is 3. - [WirePath("ok-total-unready-count")] - public string OkTotalUnreadyCount { get; set; } - /// The default is '10'. Values must be an integer number of seconds. - [WirePath("scan-interval")] - public string ScanIntervalInSeconds { get; set; } - /// The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("scale-down-delay-after-add")] - public string ScaleDownDelayAfterAdd { get; set; } - /// The default is the scan-interval. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("scale-down-delay-after-delete")] - public string ScaleDownDelayAfterDelete { get; set; } - /// The default is '3m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("scale-down-delay-after-failure")] - public string ScaleDownDelayAfterFailure { get; set; } - /// The default is '10m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("scale-down-unneeded-time")] - public string ScaleDownUnneededTime { get; set; } - /// The default is '20m'. Values must be an integer followed by an 'm'. No unit of time other than minutes (m) is supported. - [WirePath("scale-down-unready-time")] - public string ScaleDownUnreadyTime { get; set; } - /// The default is '0.5'. - [WirePath("scale-down-utilization-threshold")] - public string ScaleDownUtilizationThreshold { get; set; } - /// The default is true. - [WirePath("skip-nodes-with-local-storage")] - public string SkipNodesWithLocalStorage { get; set; } - /// The default is true. - [WirePath("skip-nodes-with-system-pods")] - public string SkipNodesWithSystemPods { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs deleted file mode 100644 index afc4075df230..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.Serialization.cs +++ /dev/null @@ -1,196 +0,0 @@ -// 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 ManagedClusterAutoUpgradeProfile : 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(ManagedClusterAutoUpgradeProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(UpgradeChannel)) - { - writer.WritePropertyName("upgradeChannel"u8); - writer.WriteStringValue(UpgradeChannel.Value.ToString()); - } - if (Optional.IsDefined(NodeOSUpgradeChannel)) - { - writer.WritePropertyName("nodeOSUpgradeChannel"u8); - writer.WriteStringValue(NodeOSUpgradeChannel.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAutoUpgradeProfile 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(ManagedClusterAutoUpgradeProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAutoUpgradeProfile(document.RootElement, options); - } - - internal static ManagedClusterAutoUpgradeProfile DeserializeManagedClusterAutoUpgradeProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - UpgradeChannel? upgradeChannel = default; - ManagedClusterNodeOSUpgradeChannel? nodeOSUpgradeChannel = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("upgradeChannel"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - upgradeChannel = new UpgradeChannel(property.Value.GetString()); - continue; - } - if (property.NameEquals("nodeOSUpgradeChannel"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - nodeOSUpgradeChannel = new ManagedClusterNodeOSUpgradeChannel(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAutoUpgradeProfile(upgradeChannel, nodeOSUpgradeChannel, 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(UpgradeChannel), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgradeChannel: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(UpgradeChannel)) - { - builder.Append(" upgradeChannel: "); - builder.AppendLine($"'{UpgradeChannel.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeOSUpgradeChannel), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" nodeOSUpgradeChannel: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NodeOSUpgradeChannel)) - { - builder.Append(" nodeOSUpgradeChannel: "); - builder.AppendLine($"'{NodeOSUpgradeChannel.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(ManagedClusterAutoUpgradeProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAutoUpgradeProfile 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); - return DeserializeManagedClusterAutoUpgradeProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAutoUpgradeProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs deleted file mode 100644 index 9caa4775c4ba..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAutoUpgradeProfile.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 -{ - /// Auto upgrade profile for a managed cluster. - public partial class ManagedClusterAutoUpgradeProfile - { - /// - /// 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 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAutoUpgradeProfile(UpgradeChannel? upgradeChannel, ManagedClusterNodeOSUpgradeChannel? nodeOSUpgradeChannel, IDictionary serializedAdditionalRawData) - { - UpgradeChannel = upgradeChannel; - NodeOSUpgradeChannel = nodeOSUpgradeChannel; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// 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. - [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 deleted file mode 100644 index dd3cbf9c4dfb..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ManagedClusterAzureMonitorProfile : 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(ManagedClusterAzureMonitorProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Metrics)) - { - writer.WritePropertyName("metrics"u8); - writer.WriteObjectValue(Metrics, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterAzureMonitorProfile 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(ManagedClusterAzureMonitorProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterAzureMonitorProfile(document.RootElement, options); - } - - internal static ManagedClusterAzureMonitorProfile DeserializeManagedClusterAzureMonitorProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterMonitorProfileMetrics metrics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("metrics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - metrics = ManagedClusterMonitorProfileMetrics.DeserializeManagedClusterMonitorProfileMetrics(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterAzureMonitorProfile(metrics, 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(Metrics), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" metrics: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Metrics)) - { - builder.Append(" metrics: "); - BicepSerializationHelpers.AppendChildObject(builder, Metrics, options, 2, false, " metrics: "); - } - } - - 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(ManagedClusterAzureMonitorProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterAzureMonitorProfile 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); - return DeserializeManagedClusterAzureMonitorProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterAzureMonitorProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs deleted file mode 100644 index 271a2f5835c8..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterAzureMonitorProfile.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// Azure Monitor addon profiles for monitoring the managed cluster. - internal partial class ManagedClusterAzureMonitorProfile - { - /// - /// 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 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterAzureMonitorProfile(ManagedClusterMonitorProfileMetrics metrics, IDictionary serializedAdditionalRawData) - { - Metrics = metrics; - _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. - [WirePath("metrics")] - public ManagedClusterMonitorProfileMetrics Metrics { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.cs deleted file mode 100644 index 0f187b769738..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.cs +++ /dev/null @@ -1,82 +0,0 @@ -// 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 -{ - /// Delegated resource properties - internal use only. - public partial class ManagedClusterDelegatedIdentity - { - /// - /// 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 ManagedClusterDelegatedIdentity() - { - } - - /// Initializes a new instance of . - /// The ARM resource id of the delegated resource - internal use only. - /// The tenant id of the delegated resource - internal use only. - /// The delegation id of the referral delegation (optional) - internal use only. - /// The source resource location - internal use only. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterDelegatedIdentity(ResourceIdentifier resourceId, Guid? tenantId, string referralResource, AzureLocation? location, IDictionary serializedAdditionalRawData) - { - ResourceId = resourceId; - TenantId = tenantId; - ReferralResource = referralResource; - Location = location; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The ARM resource id of the delegated resource - internal use only. - [WirePath("resourceId")] - public ResourceIdentifier ResourceId { get; set; } - /// The tenant id of the delegated resource - internal use only. - [WirePath("tenantId")] - public Guid? TenantId { get; set; } - /// The delegation id of the referral delegation (optional) - internal use only. - [WirePath("referralResource")] - public string ReferralResource { get; set; } - /// The source resource location - internal use only. - [WirePath("location")] - public AzureLocation? Location { 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 deleted file mode 100644 index 135e3fd845f2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.Serialization.cs +++ /dev/null @@ -1,300 +0,0 @@ -// 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 ManagedClusterHttpProxyConfig : 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(ManagedClusterHttpProxyConfig)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(HttpProxy)) - { - writer.WritePropertyName("httpProxy"u8); - writer.WriteStringValue(HttpProxy); - } - if (Optional.IsDefined(HttpsProxy)) - { - writer.WritePropertyName("httpsProxy"u8); - writer.WriteStringValue(HttpsProxy); - } - if (Optional.IsCollectionDefined(NoProxy)) - { - writer.WritePropertyName("noProxy"u8); - writer.WriteStartArray(); - foreach (var item in NoProxy) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(TrustedCA)) - { - writer.WritePropertyName("trustedCa"u8); - writer.WriteStringValue(TrustedCA); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterHttpProxyConfig 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(ManagedClusterHttpProxyConfig)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterHttpProxyConfig(document.RootElement, options); - } - - internal static ManagedClusterHttpProxyConfig DeserializeManagedClusterHttpProxyConfig(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string httpProxy = default; - string httpsProxy = default; - IList noProxy = default; - string trustedCA = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("httpProxy"u8)) - { - httpProxy = property.Value.GetString(); - continue; - } - if (property.NameEquals("httpsProxy"u8)) - { - httpsProxy = property.Value.GetString(); - continue; - } - if (property.NameEquals("noProxy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - noProxy = array; - continue; - } - if (property.NameEquals("trustedCa"u8)) - { - trustedCA = property.Value.GetString(); - 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); - } - - 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(HttpProxy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" httpProxy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HttpProxy)) - { - builder.Append(" httpProxy: "); - if (HttpProxy.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{HttpProxy}'''"); - } - else - { - builder.AppendLine($"'{HttpProxy}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HttpsProxy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" httpsProxy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(HttpsProxy)) - { - builder.Append(" httpsProxy: "); - if (HttpsProxy.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{HttpsProxy}'''"); - } - else - { - builder.AppendLine($"'{HttpsProxy}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NoProxy), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" noProxy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(NoProxy)) - { - if (NoProxy.Any()) - { - builder.Append(" noProxy: "); - builder.AppendLine("["); - foreach (var item in NoProxy) - { - 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) - { - builder.Append(" trustedCa: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(TrustedCA)) - { - builder.Append(" trustedCa: "); - if (TrustedCA.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{TrustedCA}'''"); - } - else - { - builder.AppendLine($"'{TrustedCA}'"); - } - } - } - - 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(ManagedClusterHttpProxyConfig)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterHttpProxyConfig 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); - return DeserializeManagedClusterHttpProxyConfig(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterHttpProxyConfig)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs deleted file mode 100644 index 0364bd27b21f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterHttpProxyConfig.cs +++ /dev/null @@ -1,82 +0,0 @@ -// 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 -{ - /// Cluster HTTP proxy configuration. - public partial class ManagedClusterHttpProxyConfig - { - /// - /// 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 ManagedClusterHttpProxyConfig() - { - NoProxy = 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. - /// Alternative CA cert to use for connecting to proxy servers. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterHttpProxyConfig(string httpProxy, string httpsProxy, IList noProxy, string trustedCA, IDictionary serializedAdditionalRawData) - { - HttpProxy = httpProxy; - HttpsProxy = httpsProxy; - NoProxy = noProxy; - TrustedCA = trustedCA; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The HTTP proxy server endpoint to use. - [WirePath("httpProxy")] - public string HttpProxy { get; set; } - /// The HTTPS proxy server endpoint to use. - [WirePath("httpsProxy")] - public string HttpsProxy { get; set; } - /// The endpoints that should not go through proxy. - [WirePath("noProxy")] - public IList NoProxy { get; } - /// Alternative CA cert to use for connecting to proxy servers. - [WirePath("trustedCa")] - public string TrustedCA { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterKeyVaultNetworkAccessType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterKeyVaultNetworkAccessType.cs deleted file mode 100644 index 922f44d3c2fd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterKeyVaultNetworkAccessType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Network access of key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. The default value is `Public`. - public readonly partial struct ManagedClusterKeyVaultNetworkAccessType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterKeyVaultNetworkAccessType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PublicValue = "Public"; - private const string PrivateValue = "Private"; - - /// Public. - public static ManagedClusterKeyVaultNetworkAccessType Public { get; } = new ManagedClusterKeyVaultNetworkAccessType(PublicValue); - /// Private. - public static ManagedClusterKeyVaultNetworkAccessType Private { get; } = new ManagedClusterKeyVaultNetworkAccessType(PrivateValue); - /// Determines if two values are the same. - public static bool operator ==(ManagedClusterKeyVaultNetworkAccessType left, ManagedClusterKeyVaultNetworkAccessType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedClusterKeyVaultNetworkAccessType left, ManagedClusterKeyVaultNetworkAccessType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterKeyVaultNetworkAccessType(string value) => new ManagedClusterKeyVaultNetworkAccessType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterKeyVaultNetworkAccessType other && Equals(other); - /// - public bool Equals(ManagedClusterKeyVaultNetworkAccessType 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/ManagedClusterListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs deleted file mode 100644 index eb9f870e465d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 ManagedClusterListResult : 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(ManagedClusterListResult)} 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterListResult 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(ManagedClusterListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterListResult(document.RootElement, options); - } - - internal static ManagedClusterListResult DeserializeManagedClusterListResult(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(ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(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 ManagedClusterListResult(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(ManagedClusterListResult)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterListResult 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); - return DeserializeManagedClusterListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs deleted file mode 100644 index 1e21abb032b7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterListResult.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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 Clusters operation. - internal partial class ManagedClusterListResult - { - /// - /// 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 ManagedClusterListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The list of managed clusters. - /// The URL to get the next set of managed cluster results. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The list of managed clusters. - public IReadOnlyList Value { get; } - /// The URL to get the next set of managed cluster results. - public string NextLink { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerBackendPoolType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerBackendPoolType.cs deleted file mode 100644 index 981d2602e3c7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerBackendPoolType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 type of the managed inbound Load Balancer BackendPool. - public readonly partial struct ManagedClusterLoadBalancerBackendPoolType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterLoadBalancerBackendPoolType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NodeIPConfigurationValue = "NodeIPConfiguration"; - private const string NodeIPValue = "NodeIP"; - - /// The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. - public static ManagedClusterLoadBalancerBackendPoolType NodeIPConfiguration { get; } = new ManagedClusterLoadBalancerBackendPoolType(NodeIPConfigurationValue); - /// The type of the managed inbound Load Balancer BackendPool. https://cloud-provider-azure.sigs.k8s.io/topics/loadbalancer/#configure-load-balancer-backend. - public static ManagedClusterLoadBalancerBackendPoolType NodeIP { get; } = new ManagedClusterLoadBalancerBackendPoolType(NodeIPValue); - /// Determines if two values are the same. - public static bool operator ==(ManagedClusterLoadBalancerBackendPoolType left, ManagedClusterLoadBalancerBackendPoolType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedClusterLoadBalancerBackendPoolType left, ManagedClusterLoadBalancerBackendPoolType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterLoadBalancerBackendPoolType(string value) => new ManagedClusterLoadBalancerBackendPoolType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterLoadBalancerBackendPoolType other && Equals(other); - /// - public bool Equals(ManagedClusterLoadBalancerBackendPoolType 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/ManagedClusterLoadBalancerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs deleted file mode 100644 index 4713017a6c11..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.Serialization.cs +++ /dev/null @@ -1,412 +0,0 @@ -// 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.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - public partial class ManagedClusterLoadBalancerProfile : 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(ManagedClusterLoadBalancerProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ManagedOutboundIPs)) - { - writer.WritePropertyName("managedOutboundIPs"u8); - writer.WriteObjectValue(ManagedOutboundIPs, options); - } - if (Optional.IsDefined(OutboundIPPrefixes)) - { - writer.WritePropertyName("outboundIPPrefixes"u8); - writer.WriteObjectValue(OutboundIPPrefixes, options); - } - if (Optional.IsDefined(OutboundIPs)) - { - writer.WritePropertyName("outboundIPs"u8); - writer.WriteObjectValue(OutboundIPs, options); - } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) - { - writer.WritePropertyName("effectiveOutboundIPs"u8); - writer.WriteStartArray(); - foreach (var item in EffectiveOutboundIPs) - { - JsonSerializer.Serialize(writer, item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(AllocatedOutboundPorts)) - { - writer.WritePropertyName("allocatedOutboundPorts"u8); - writer.WriteNumberValue(AllocatedOutboundPorts.Value); - } - if (Optional.IsDefined(IdleTimeoutInMinutes)) - { - writer.WritePropertyName("idleTimeoutInMinutes"u8); - writer.WriteNumberValue(IdleTimeoutInMinutes.Value); - } - if (Optional.IsDefined(EnableMultipleStandardLoadBalancers)) - { - writer.WritePropertyName("enableMultipleStandardLoadBalancers"u8); - writer.WriteBooleanValue(EnableMultipleStandardLoadBalancers.Value); - } - if (Optional.IsDefined(BackendPoolType)) - { - writer.WritePropertyName("backendPoolType"u8); - writer.WriteStringValue(BackendPoolType.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterLoadBalancerProfile 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(ManagedClusterLoadBalancerProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterLoadBalancerProfile(document.RootElement, options); - } - - internal static ManagedClusterLoadBalancerProfile DeserializeManagedClusterLoadBalancerProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterLoadBalancerProfileManagedOutboundIPs managedOutboundIPs = default; - ManagedClusterLoadBalancerProfileOutboundIPPrefixes outboundIPPrefixes = default; - ManagedClusterLoadBalancerProfileOutboundIPs outboundIPs = default; - IList effectiveOutboundIPs = default; - int? allocatedOutboundPorts = default; - int? idleTimeoutInMinutes = default; - bool? enableMultipleStandardLoadBalancers = default; - ManagedClusterLoadBalancerBackendPoolType? backendPoolType = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("managedOutboundIPs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managedOutboundIPs = ManagedClusterLoadBalancerProfileManagedOutboundIPs.DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(property.Value, options); - continue; - } - if (property.NameEquals("outboundIPPrefixes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - outboundIPPrefixes = ManagedClusterLoadBalancerProfileOutboundIPPrefixes.DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(property.Value, options); - continue; - } - if (property.NameEquals("outboundIPs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - outboundIPs = ManagedClusterLoadBalancerProfileOutboundIPs.DeserializeManagedClusterLoadBalancerProfileOutboundIPs(property.Value, options); - continue; - } - if (property.NameEquals("effectiveOutboundIPs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(JsonSerializer.Deserialize(item.GetRawText())); - } - effectiveOutboundIPs = array; - continue; - } - if (property.NameEquals("allocatedOutboundPorts"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allocatedOutboundPorts = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("idleTimeoutInMinutes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - idleTimeoutInMinutes = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("enableMultipleStandardLoadBalancers"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableMultipleStandardLoadBalancers = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("backendPoolType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - backendPoolType = new ManagedClusterLoadBalancerBackendPoolType(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterLoadBalancerProfile( - managedOutboundIPs, - outboundIPPrefixes, - outboundIPs, - effectiveOutboundIPs ?? new ChangeTrackingList(), - allocatedOutboundPorts, - idleTimeoutInMinutes, - enableMultipleStandardLoadBalancers, - backendPoolType, - 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(ManagedOutboundIPs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" managedOutboundIPs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ManagedOutboundIPs)) - { - builder.Append(" managedOutboundIPs: "); - BicepSerializationHelpers.AppendChildObject(builder, ManagedOutboundIPs, options, 2, false, " managedOutboundIPs: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("OutboundPublicIPPrefixes", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" outboundIPPrefixes: "); - builder.AppendLine("{"); - builder.Append(" publicIPPrefixes: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(OutboundIPPrefixes)) - { - builder.Append(" outboundIPPrefixes: "); - BicepSerializationHelpers.AppendChildObject(builder, OutboundIPPrefixes, options, 2, false, " outboundIPPrefixes: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("OutboundPublicIPs", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" outboundIPs: "); - builder.AppendLine("{"); - builder.Append(" publicIPs: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(OutboundIPs)) - { - builder.Append(" outboundIPs: "); - BicepSerializationHelpers.AppendChildObject(builder, OutboundIPs, options, 2, false, " outboundIPs: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EffectiveOutboundIPs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" effectiveOutboundIPs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) - { - if (EffectiveOutboundIPs.Any()) - { - builder.Append(" effectiveOutboundIPs: "); - builder.AppendLine("["); - foreach (var item in EffectiveOutboundIPs) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " effectiveOutboundIPs: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllocatedOutboundPorts), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" allocatedOutboundPorts: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AllocatedOutboundPorts)) - { - builder.Append(" allocatedOutboundPorts: "); - builder.AppendLine($"{AllocatedOutboundPorts.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdleTimeoutInMinutes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" idleTimeoutInMinutes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IdleTimeoutInMinutes)) - { - builder.Append(" idleTimeoutInMinutes: "); - builder.AppendLine($"{IdleTimeoutInMinutes.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableMultipleStandardLoadBalancers), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableMultipleStandardLoadBalancers: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(EnableMultipleStandardLoadBalancers)) - { - builder.Append(" enableMultipleStandardLoadBalancers: "); - var boolValue = EnableMultipleStandardLoadBalancers.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BackendPoolType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" backendPoolType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(BackendPoolType)) - { - builder.Append(" backendPoolType: "); - builder.AppendLine($"'{BackendPoolType.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(ManagedClusterLoadBalancerProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterLoadBalancerProfile 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); - return DeserializeManagedClusterLoadBalancerProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterLoadBalancerProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs deleted file mode 100644 index a40f522564dc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfile.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Profile of the managed cluster load balancer. - public partial class ManagedClusterLoadBalancerProfile - { - /// - /// 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 ManagedClusterLoadBalancerProfile() - { - EffectiveOutboundIPs = new ChangeTrackingList(); - } - - /// 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. - /// 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) - { - ManagedOutboundIPs = managedOutboundIPs; - OutboundIPPrefixes = outboundIPPrefixes; - OutboundIPs = outboundIPs; - EffectiveOutboundIPs = effectiveOutboundIPs; - AllocatedOutboundPorts = allocatedOutboundPorts; - IdleTimeoutInMinutes = idleTimeoutInMinutes; - EnableMultipleStandardLoadBalancers = enableMultipleStandardLoadBalancers; - BackendPoolType = backendPoolType; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Desired managed outbound IPs for the cluster load balancer. - [WirePath("managedOutboundIPs")] - public ManagedClusterLoadBalancerProfileManagedOutboundIPs ManagedOutboundIPs { get; set; } - /// Desired outbound IP Prefix resources for the cluster load balancer. - internal ManagedClusterLoadBalancerProfileOutboundIPPrefixes OutboundIPPrefixes { get; set; } - /// A list of public IP prefix resources. - [WirePath("outboundIPPrefixes.publicIPPrefixes")] - public IList OutboundPublicIPPrefixes - { - get - { - if (OutboundIPPrefixes is null) - OutboundIPPrefixes = new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(); - return OutboundIPPrefixes.PublicIPPrefixes; - } - } - - /// Desired outbound IP resources for the cluster load balancer. - internal ManagedClusterLoadBalancerProfileOutboundIPs OutboundIPs { get; set; } - /// A list of public IP resources. - [WirePath("outboundIPs.publicIPs")] - public IList OutboundPublicIPs - { - get - { - if (OutboundIPs is null) - OutboundIPs = new ManagedClusterLoadBalancerProfileOutboundIPs(); - return OutboundIPs.PublicIPs; - } - } - - /// The effective outbound IP resources of the cluster load balancer. - [WirePath("effectiveOutboundIPs")] - public IList 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; } - /// Desired outbound flow idle timeout in minutes. Allowed values are in the range of 4 to 120 (inclusive). The default value is 30 minutes. - [WirePath("idleTimeoutInMinutes")] - public int? IdleTimeoutInMinutes { get; set; } - /// Enable multiple standard load balancers per AKS cluster or not. - [WirePath("enableMultipleStandardLoadBalancers")] - public bool? EnableMultipleStandardLoadBalancers { get; set; } - /// The type of the managed inbound Load Balancer BackendPool. - [WirePath("backendPoolType")] - public ManagedClusterLoadBalancerBackendPoolType? BackendPoolType { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs deleted file mode 100644 index ed9d33af556e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.Serialization.cs +++ /dev/null @@ -1,196 +0,0 @@ -// 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 ManagedClusterLoadBalancerProfileManagedOutboundIPs : 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(ManagedClusterLoadBalancerProfileManagedOutboundIPs)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Count)) - { - writer.WritePropertyName("count"u8); - writer.WriteNumberValue(Count.Value); - } - if (Optional.IsDefined(CountIPv6)) - { - writer.WritePropertyName("countIPv6"u8); - writer.WriteNumberValue(CountIPv6.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterLoadBalancerProfileManagedOutboundIPs 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(ManagedClusterLoadBalancerProfileManagedOutboundIPs)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(document.RootElement, options); - } - - internal static ManagedClusterLoadBalancerProfileManagedOutboundIPs DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? count = default; - int? countIPv6 = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("count"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - count = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("countIPv6"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - countIPv6 = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterLoadBalancerProfileManagedOutboundIPs(count, countIPv6, 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(Count), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" count: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Count)) - { - builder.Append(" count: "); - builder.AppendLine($"{Count.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CountIPv6), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" countIPv6: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(CountIPv6)) - { - builder.Append(" countIPv6: "); - builder.AppendLine($"{CountIPv6.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(ManagedClusterLoadBalancerProfileManagedOutboundIPs)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterLoadBalancerProfileManagedOutboundIPs 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); - return DeserializeManagedClusterLoadBalancerProfileManagedOutboundIPs(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterLoadBalancerProfileManagedOutboundIPs)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs deleted file mode 100644 index 20758660504f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileManagedOutboundIPs.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 -{ - /// Desired managed outbound IPs for the cluster load balancer. - public partial class ManagedClusterLoadBalancerProfileManagedOutboundIPs - { - /// - /// 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 ManagedClusterLoadBalancerProfileManagedOutboundIPs() - { - } - - /// Initializes a new instance of . - /// The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - /// The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterLoadBalancerProfileManagedOutboundIPs(int? count, int? countIPv6, IDictionary serializedAdditionalRawData) - { - Count = count; - CountIPv6 = countIPv6; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The desired number of IPv4 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 1. - [WirePath("count")] - public int? Count { get; set; } - /// The desired number of IPv6 outbound IPs created/managed by Azure for the cluster load balancer. Allowed values must be in the range of 1 to 100 (inclusive). The default value is 0 for single-stack and 1 for dual-stack. - [WirePath("countIPv6")] - public int? CountIPv6 { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs deleted file mode 100644 index 27ff09ca6d66..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.Serialization.cs +++ /dev/null @@ -1,186 +0,0 @@ -// 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.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - internal partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes : 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(ManagedClusterLoadBalancerProfileOutboundIPPrefixes)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(PublicIPPrefixes)) - { - writer.WritePropertyName("publicIPPrefixes"u8); - writer.WriteStartArray(); - foreach (var item in PublicIPPrefixes) - { - JsonSerializer.Serialize(writer, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterLoadBalancerProfileOutboundIPPrefixes 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(ManagedClusterLoadBalancerProfileOutboundIPPrefixes)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(document.RootElement, options); - } - - internal static ManagedClusterLoadBalancerProfileOutboundIPPrefixes DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList publicIPPrefixes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("publicIPPrefixes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(JsonSerializer.Deserialize(item.GetRawText())); - } - publicIPPrefixes = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterLoadBalancerProfileOutboundIPPrefixes(publicIPPrefixes ?? 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(PublicIPPrefixes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicIPPrefixes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PublicIPPrefixes)) - { - if (PublicIPPrefixes.Any()) - { - builder.Append(" publicIPPrefixes: "); - builder.AppendLine("["); - foreach (var item in PublicIPPrefixes) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " publicIPPrefixes: "); - } - 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(ManagedClusterLoadBalancerProfileOutboundIPPrefixes)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterLoadBalancerProfileOutboundIPPrefixes 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); - return DeserializeManagedClusterLoadBalancerProfileOutboundIPPrefixes(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterLoadBalancerProfileOutboundIPPrefixes)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs deleted file mode 100644 index d57a7d1773f0..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPPrefixes.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Desired outbound IP Prefix resources for the cluster load balancer. - internal partial class ManagedClusterLoadBalancerProfileOutboundIPPrefixes - { - /// - /// 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 ManagedClusterLoadBalancerProfileOutboundIPPrefixes() - { - PublicIPPrefixes = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of public IP prefix resources. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterLoadBalancerProfileOutboundIPPrefixes(IList publicIPPrefixes, IDictionary serializedAdditionalRawData) - { - PublicIPPrefixes = publicIPPrefixes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of public IP prefix resources. - [WirePath("publicIPPrefixes")] - public IList PublicIPPrefixes { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs deleted file mode 100644 index ea7737c1b4cd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.Serialization.cs +++ /dev/null @@ -1,186 +0,0 @@ -// 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.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - internal partial class ManagedClusterLoadBalancerProfileOutboundIPs : 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(ManagedClusterLoadBalancerProfileOutboundIPs)} does not support writing '{format}' format."); - } - - if (Optional.IsCollectionDefined(PublicIPs)) - { - writer.WritePropertyName("publicIPs"u8); - writer.WriteStartArray(); - foreach (var item in PublicIPs) - { - JsonSerializer.Serialize(writer, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterLoadBalancerProfileOutboundIPs 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(ManagedClusterLoadBalancerProfileOutboundIPs)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterLoadBalancerProfileOutboundIPs(document.RootElement, options); - } - - internal static ManagedClusterLoadBalancerProfileOutboundIPs DeserializeManagedClusterLoadBalancerProfileOutboundIPs(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IList publicIPs = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("publicIPs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(JsonSerializer.Deserialize(item.GetRawText())); - } - publicIPs = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterLoadBalancerProfileOutboundIPs(publicIPs ?? 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(PublicIPs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" publicIPs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PublicIPs)) - { - if (PublicIPs.Any()) - { - builder.Append(" publicIPs: "); - builder.AppendLine("["); - foreach (var item in PublicIPs) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " publicIPs: "); - } - 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(ManagedClusterLoadBalancerProfileOutboundIPs)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterLoadBalancerProfileOutboundIPs 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); - return DeserializeManagedClusterLoadBalancerProfileOutboundIPs(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterLoadBalancerProfileOutboundIPs)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs deleted file mode 100644 index 1a61fb535839..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterLoadBalancerProfileOutboundIPs.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Desired outbound IP resources for the cluster load balancer. - internal partial class ManagedClusterLoadBalancerProfileOutboundIPs - { - /// - /// 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 ManagedClusterLoadBalancerProfileOutboundIPs() - { - PublicIPs = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// A list of public IP resources. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterLoadBalancerProfileOutboundIPs(IList publicIPs, IDictionary serializedAdditionalRawData) - { - PublicIPs = publicIPs; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// A list of public IP resources. - [WirePath("publicIPs")] - public IList PublicIPs { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs deleted file mode 100644 index 8dfcd1eb52ed..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ManagedClusterManagedOutboundIPProfile : 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(ManagedClusterManagedOutboundIPProfile)} does not support writing '{format}' format."); - } - - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterManagedOutboundIPProfile 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(ManagedClusterManagedOutboundIPProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterManagedOutboundIPProfile(document.RootElement, options); - } - - internal static ManagedClusterManagedOutboundIPProfile DeserializeManagedClusterManagedOutboundIPProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? count = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 ManagedClusterManagedOutboundIPProfile(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(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(ManagedClusterManagedOutboundIPProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterManagedOutboundIPProfile 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); - return DeserializeManagedClusterManagedOutboundIPProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterManagedOutboundIPProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs deleted file mode 100644 index 2d17f2798ed5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterManagedOutboundIPProfile.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 outbound IP resources of the managed cluster. - internal partial class ManagedClusterManagedOutboundIPProfile - { - /// - /// 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 ManagedClusterManagedOutboundIPProfile() - { - } - - /// Initializes a new instance of . - /// The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterManagedOutboundIPProfile(int? count, IDictionary serializedAdditionalRawData) - { - Count = count; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. - [WirePath("count")] - public int? Count { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs deleted file mode 100644 index ac2ec9496293..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.Serialization.cs +++ /dev/null @@ -1,204 +0,0 @@ -// 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 ManagedClusterMonitorProfileKubeStateMetrics : 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(ManagedClusterMonitorProfileKubeStateMetrics)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(MetricLabelsAllowlist)) - { - writer.WritePropertyName("metricLabelsAllowlist"u8); - writer.WriteStringValue(MetricLabelsAllowlist); - } - if (Optional.IsDefined(MetricAnnotationsAllowList)) - { - writer.WritePropertyName("metricAnnotationsAllowList"u8); - writer.WriteStringValue(MetricAnnotationsAllowList); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterMonitorProfileKubeStateMetrics 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(ManagedClusterMonitorProfileKubeStateMetrics)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterMonitorProfileKubeStateMetrics(document.RootElement, options); - } - - internal static ManagedClusterMonitorProfileKubeStateMetrics DeserializeManagedClusterMonitorProfileKubeStateMetrics(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string metricLabelsAllowlist = default; - string metricAnnotationsAllowList = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("metricLabelsAllowlist"u8)) - { - metricLabelsAllowlist = property.Value.GetString(); - continue; - } - if (property.NameEquals("metricAnnotationsAllowList"u8)) - { - metricAnnotationsAllowList = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterMonitorProfileKubeStateMetrics(metricLabelsAllowlist, metricAnnotationsAllowList, 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(MetricLabelsAllowlist), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" metricLabelsAllowlist: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MetricLabelsAllowlist)) - { - builder.Append(" metricLabelsAllowlist: "); - if (MetricLabelsAllowlist.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MetricLabelsAllowlist}'''"); - } - else - { - builder.AppendLine($"'{MetricLabelsAllowlist}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MetricAnnotationsAllowList), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" metricAnnotationsAllowList: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(MetricAnnotationsAllowList)) - { - builder.Append(" metricAnnotationsAllowList: "); - if (MetricAnnotationsAllowList.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{MetricAnnotationsAllowList}'''"); - } - else - { - builder.AppendLine($"'{MetricAnnotationsAllowList}'"); - } - } - } - - 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(ManagedClusterMonitorProfileKubeStateMetrics)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterMonitorProfileKubeStateMetrics 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); - return DeserializeManagedClusterMonitorProfileKubeStateMetrics(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterMonitorProfileKubeStateMetrics)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs deleted file mode 100644 index 116f6cef5d12..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileKubeStateMetrics.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 -{ - /// 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. - public partial class ManagedClusterMonitorProfileKubeStateMetrics - { - /// - /// 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 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterMonitorProfileKubeStateMetrics(string metricLabelsAllowlist, string metricAnnotationsAllowList, IDictionary serializedAdditionalRawData) - { - MetricLabelsAllowlist = metricLabelsAllowlist; - MetricAnnotationsAllowList = metricAnnotationsAllowList; - _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. - [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. - [WirePath("metricAnnotationsAllowList")] - public string MetricAnnotationsAllowList { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs deleted file mode 100644 index e4e628ff4204..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.Serialization.cs +++ /dev/null @@ -1,187 +0,0 @@ -// 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 ManagedClusterMonitorProfileMetrics : 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(ManagedClusterMonitorProfileMetrics)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled); - if (Optional.IsDefined(KubeStateMetrics)) - { - writer.WritePropertyName("kubeStateMetrics"u8); - writer.WriteObjectValue(KubeStateMetrics, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterMonitorProfileMetrics 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(ManagedClusterMonitorProfileMetrics)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterMonitorProfileMetrics(document.RootElement, options); - } - - internal static ManagedClusterMonitorProfileMetrics DeserializeManagedClusterMonitorProfileMetrics(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool enabled = default; - ManagedClusterMonitorProfileKubeStateMetrics kubeStateMetrics = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("enabled"u8)) - { - enabled = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("kubeStateMetrics"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kubeStateMetrics = ManagedClusterMonitorProfileKubeStateMetrics.DeserializeManagedClusterMonitorProfileKubeStateMetrics(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterMonitorProfileMetrics(enabled, kubeStateMetrics, 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enabled: "); - var boolValue = IsEnabled == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeStateMetrics), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kubeStateMetrics: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KubeStateMetrics)) - { - builder.Append(" kubeStateMetrics: "); - BicepSerializationHelpers.AppendChildObject(builder, KubeStateMetrics, options, 2, false, " kubeStateMetrics: "); - } - } - - 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(ManagedClusterMonitorProfileMetrics)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterMonitorProfileMetrics 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); - return DeserializeManagedClusterMonitorProfileMetrics(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterMonitorProfileMetrics)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs deleted file mode 100644 index ad0cbaa3c2b8..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterMonitorProfileMetrics.cs +++ /dev/null @@ -1,78 +0,0 @@ -// 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 -{ - /// 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. - public partial class ManagedClusterMonitorProfileMetrics - { - /// - /// 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 to enable or disable the Azure Managed Prometheus addon for Prometheus monitoring. See aka.ms/AzureManagedPrometheus-aks-enable for details on enabling and disabling. - 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterMonitorProfileMetrics(bool isEnabled, ManagedClusterMonitorProfileKubeStateMetrics kubeStateMetrics, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - KubeStateMetrics = kubeStateMetrics; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - 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. - [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. - [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 deleted file mode 100644 index 3619fe2fc0b9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.Serialization.cs +++ /dev/null @@ -1,249 +0,0 @@ -// 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.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - public partial class ManagedClusterNatGatewayProfile : 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(ManagedClusterNatGatewayProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ManagedOutboundIPProfile)) - { - writer.WritePropertyName("managedOutboundIPProfile"u8); - writer.WriteObjectValue(ManagedOutboundIPProfile, options); - } - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) - { - writer.WritePropertyName("effectiveOutboundIPs"u8); - writer.WriteStartArray(); - foreach (var item in EffectiveOutboundIPs) - { - JsonSerializer.Serialize(writer, item); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(IdleTimeoutInMinutes)) - { - writer.WritePropertyName("idleTimeoutInMinutes"u8); - writer.WriteNumberValue(IdleTimeoutInMinutes.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterNatGatewayProfile 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(ManagedClusterNatGatewayProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterNatGatewayProfile(document.RootElement, options); - } - - internal static ManagedClusterNatGatewayProfile DeserializeManagedClusterNatGatewayProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile = default; - IList effectiveOutboundIPs = default; - int? idleTimeoutInMinutes = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("managedOutboundIPProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - managedOutboundIPProfile = ManagedClusterManagedOutboundIPProfile.DeserializeManagedClusterManagedOutboundIPProfile(property.Value, options); - continue; - } - if (property.NameEquals("effectiveOutboundIPs"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(JsonSerializer.Deserialize(item.GetRawText())); - } - effectiveOutboundIPs = array; - continue; - } - if (property.NameEquals("idleTimeoutInMinutes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - idleTimeoutInMinutes = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterNatGatewayProfile(managedOutboundIPProfile, effectiveOutboundIPs ?? new ChangeTrackingList(), idleTimeoutInMinutes, 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("ManagedOutboundIPCount", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" managedOutboundIPProfile: "); - builder.AppendLine("{"); - builder.Append(" count: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(ManagedOutboundIPProfile)) - { - builder.Append(" managedOutboundIPProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, ManagedOutboundIPProfile, options, 2, false, " managedOutboundIPProfile: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EffectiveOutboundIPs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" effectiveOutboundIPs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(EffectiveOutboundIPs)) - { - if (EffectiveOutboundIPs.Any()) - { - builder.Append(" effectiveOutboundIPs: "); - builder.AppendLine("["); - foreach (var item in EffectiveOutboundIPs) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " effectiveOutboundIPs: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdleTimeoutInMinutes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" idleTimeoutInMinutes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IdleTimeoutInMinutes)) - { - builder.Append(" idleTimeoutInMinutes: "); - builder.AppendLine($"{IdleTimeoutInMinutes.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(ManagedClusterNatGatewayProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterNatGatewayProfile 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); - return DeserializeManagedClusterNatGatewayProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterNatGatewayProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs deleted file mode 100644 index 047d979ffec0..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNatGatewayProfile.cs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Profile of the managed cluster NAT gateway. - public partial class ManagedClusterNatGatewayProfile - { - /// - /// 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 ManagedClusterNatGatewayProfile() - { - EffectiveOutboundIPs = new ChangeTrackingList(); - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterNatGatewayProfile(ManagedClusterManagedOutboundIPProfile managedOutboundIPProfile, IList effectiveOutboundIPs, int? idleTimeoutInMinutes, IDictionary serializedAdditionalRawData) - { - ManagedOutboundIPProfile = managedOutboundIPProfile; - EffectiveOutboundIPs = effectiveOutboundIPs; - IdleTimeoutInMinutes = idleTimeoutInMinutes; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Profile of the managed outbound IP resources of the cluster NAT gateway. - internal ManagedClusterManagedOutboundIPProfile ManagedOutboundIPProfile { get; set; } - /// The desired number of outbound IPs created/managed by Azure. Allowed values must be in the range of 1 to 16 (inclusive). The default value is 1. - [WirePath("managedOutboundIPProfile.count")] - public int? ManagedOutboundIPCount - { - get => ManagedOutboundIPProfile is null ? default : ManagedOutboundIPProfile.Count; - set - { - if (ManagedOutboundIPProfile is null) - ManagedOutboundIPProfile = new ManagedClusterManagedOutboundIPProfile(); - ManagedOutboundIPProfile.Count = value; - } - } - - /// The effective outbound IP resources of the cluster NAT gateway. - [WirePath("effectiveOutboundIPs")] - public IList 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 deleted file mode 100644 index 5fd9240d2cc8..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterNodeOSUpgradeChannel.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Manner in which the OS on your nodes is updated. The default is NodeImage. - public readonly partial struct ManagedClusterNodeOSUpgradeChannel : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterNodeOSUpgradeChannel(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "None"; - private const string UnmanagedValue = "Unmanaged"; - 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. - public static ManagedClusterNodeOSUpgradeChannel Unmanaged { get; } = new ManagedClusterNodeOSUpgradeChannel(UnmanagedValue); - /// 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. - public static bool operator ==(ManagedClusterNodeOSUpgradeChannel left, ManagedClusterNodeOSUpgradeChannel right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedClusterNodeOSUpgradeChannel left, ManagedClusterNodeOSUpgradeChannel right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterNodeOSUpgradeChannel(string value) => new ManagedClusterNodeOSUpgradeChannel(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterNodeOSUpgradeChannel other && Equals(other); - /// - public bool Equals(ManagedClusterNodeOSUpgradeChannel 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/ManagedClusterOidcIssuerProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs deleted file mode 100644 index 17e50fe1db91..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterOidcIssuerProfile.Serialization.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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 ManagedClusterOidcIssuerProfile : 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(ManagedClusterOidcIssuerProfile)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(IssuerUriInfo)) - { - writer.WritePropertyName("issuerURL"u8); - writer.WriteStringValue(IssuerUriInfo); - } - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterOidcIssuerProfile 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(ManagedClusterOidcIssuerProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterOidcIssuerProfile(document.RootElement, options); - } - - internal static ManagedClusterOidcIssuerProfile DeserializeManagedClusterOidcIssuerProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string issuerUrl = default; - bool? enabled = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("issuerURL"u8)) - { - issuerUrl = 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 ManagedClusterOidcIssuerProfile(issuerUrl, 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(IssuerUriInfo), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" issuerURL: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IssuerUriInfo)) - { - builder.Append(" issuerURL: "); - if (IssuerUriInfo.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{IssuerUriInfo}'''"); - } - else - { - builder.AppendLine($"'{IssuerUriInfo}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.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(ManagedClusterOidcIssuerProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterOidcIssuerProfile 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); - return DeserializeManagedClusterOidcIssuerProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterOidcIssuerProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs deleted file mode 100644 index e4ddb6284054..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.cs +++ /dev/null @@ -1,112 +0,0 @@ -// 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 -{ - /// Details about the pod identity assigned to the Managed Cluster. - public partial class ManagedClusterPodIdentity - { - /// - /// 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 name of the pod identity. - /// The namespace of the pod identity. - /// The user assigned identity details. - /// , or is null. - public ManagedClusterPodIdentity(string name, string @namespace, ContainerServiceUserAssignedIdentity identity) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(@namespace, nameof(@namespace)); - Argument.AssertNotNull(identity, nameof(identity)); - - Name = name; - Namespace = @namespace; - Identity = identity; - } - - /// Initializes a new instance of . - /// The name of the pod identity. - /// The namespace of the pod identity. - /// The binding selector to use for the AzureIdentityBinding resource. - /// The user assigned identity details. - /// The current provisioning state of the pod identity. - /// - /// Keeps track of any properties unknown to the library. - internal ManagedClusterPodIdentity(string name, string @namespace, string bindingSelector, ContainerServiceUserAssignedIdentity identity, ManagedClusterPodIdentityProvisioningState? provisioningState, ManagedClusterPodIdentityProvisioningInfo provisioningInfo, IDictionary serializedAdditionalRawData) - { - Name = name; - Namespace = @namespace; - BindingSelector = bindingSelector; - Identity = identity; - ProvisioningState = provisioningState; - ProvisioningInfo = provisioningInfo; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterPodIdentity() - { - } - - /// The name of the pod identity. - [WirePath("name")] - public string Name { get; set; } - /// The namespace of the pod identity. - [WirePath("namespace")] - public string Namespace { get; set; } - /// The binding selector to use for the AzureIdentityBinding resource. - [WirePath("bindingSelector")] - public string BindingSelector { get; set; } - /// The user assigned identity details. - [WirePath("identity")] - public ContainerServiceUserAssignedIdentity Identity { get; set; } - /// The current provisioning state of the pod identity. - [WirePath("provisioningState")] - public ManagedClusterPodIdentityProvisioningState? ProvisioningState { get; } - /// Gets the provisioning info. - internal ManagedClusterPodIdentityProvisioningInfo ProvisioningInfo { get; } - /// Details about the error. - [WirePath("provisioningInfo.error.error")] - public ResponseError ErrorDetail - { - get => ProvisioningInfo?.ErrorDetail; - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs deleted file mode 100644 index a5baf0167e90..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.Serialization.cs +++ /dev/null @@ -1,255 +0,0 @@ -// 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 ManagedClusterPodIdentityException : 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(ManagedClusterPodIdentityException)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("namespace"u8); - writer.WriteStringValue(Namespace); - writer.WritePropertyName("podLabels"u8); - writer.WriteStartObject(); - foreach (var item in PodLabels) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterPodIdentityException 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(ManagedClusterPodIdentityException)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPodIdentityException(document.RootElement, options); - } - - internal static ManagedClusterPodIdentityException DeserializeManagedClusterPodIdentityException(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string name = default; - string @namespace = default; - IDictionary podLabels = 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("namespace"u8)) - { - @namespace = property.Value.GetString(); - continue; - } - if (property.NameEquals("podLabels"u8)) - { - Dictionary dictionary = new Dictionary(); - foreach (var property0 in property.Value.EnumerateObject()) - { - dictionary.Add(property0.Name, property0.Value.GetString()); - } - podLabels = dictionary; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPodIdentityException(name, @namespace, podLabels, 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(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(PodLabels), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" podLabels: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(PodLabels)) - { - if (PodLabels.Any()) - { - builder.Append(" podLabels: "); - builder.AppendLine("{"); - foreach (var item in PodLabels) - { - 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("}"); - 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(ManagedClusterPodIdentityException)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterPodIdentityException 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); - return DeserializeManagedClusterPodIdentityException(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentityException)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs deleted file mode 100644 index efaab255ec0a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityException.cs +++ /dev/null @@ -1,92 +0,0 @@ -// 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 -{ - /// See [disable AAD Pod Identity for a specific Pod/Application](https://azure.github.io/aad-pod-identity/docs/configure/application_exception/) for more details. - public partial class ManagedClusterPodIdentityException - { - /// - /// 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 name of the pod identity exception. - /// The namespace of the pod identity exception. - /// The pod labels to match. - /// , or is null. - public ManagedClusterPodIdentityException(string name, string @namespace, IDictionary podLabels) - { - Argument.AssertNotNull(name, nameof(name)); - Argument.AssertNotNull(@namespace, nameof(@namespace)); - Argument.AssertNotNull(podLabels, nameof(podLabels)); - - Name = name; - Namespace = @namespace; - PodLabels = podLabels; - } - - /// Initializes a new instance of . - /// The name of the pod identity exception. - /// The namespace of the pod identity exception. - /// The pod labels to match. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterPodIdentityException(string name, string @namespace, IDictionary podLabels, IDictionary serializedAdditionalRawData) - { - Name = name; - Namespace = @namespace; - PodLabels = podLabels; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterPodIdentityException() - { - } - - /// The name of the pod identity exception. - [WirePath("name")] - public string Name { get; set; } - /// The namespace of the pod identity exception. - [WirePath("namespace")] - public string Namespace { get; set; } - /// The pod labels to match. - [WirePath("podLabels")] - public IDictionary PodLabels { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs deleted file mode 100644 index 60299ae33315..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.Serialization.cs +++ /dev/null @@ -1,295 +0,0 @@ -// 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 ManagedClusterPodIdentityProfile : 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(ManagedClusterPodIdentityProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(AllowNetworkPluginKubenet)) - { - writer.WritePropertyName("allowNetworkPluginKubenet"u8); - writer.WriteBooleanValue(AllowNetworkPluginKubenet.Value); - } - if (Optional.IsCollectionDefined(UserAssignedIdentities)) - { - writer.WritePropertyName("userAssignedIdentities"u8); - writer.WriteStartArray(); - foreach (var item in UserAssignedIdentities) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(UserAssignedIdentityExceptions)) - { - writer.WritePropertyName("userAssignedIdentityExceptions"u8); - writer.WriteStartArray(); - foreach (var item in UserAssignedIdentityExceptions) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterPodIdentityProfile 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(ManagedClusterPodIdentityProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPodIdentityProfile(document.RootElement, options); - } - - internal static ManagedClusterPodIdentityProfile DeserializeManagedClusterPodIdentityProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? enabled = default; - bool? allowNetworkPluginKubenet = default; - IList userAssignedIdentities = default; - IList userAssignedIdentityExceptions = 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("allowNetworkPluginKubenet"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - allowNetworkPluginKubenet = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("userAssignedIdentities"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ManagedClusterPodIdentity.DeserializeManagedClusterPodIdentity(item, options)); - } - userAssignedIdentities = array; - continue; - } - if (property.NameEquals("userAssignedIdentityExceptions"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ManagedClusterPodIdentityException.DeserializeManagedClusterPodIdentityException(item, options)); - } - userAssignedIdentityExceptions = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPodIdentityProfile(enabled, allowNetworkPluginKubenet, userAssignedIdentities ?? new ChangeTrackingList(), userAssignedIdentityExceptions ?? 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowNetworkPluginKubenet), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" allowNetworkPluginKubenet: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AllowNetworkPluginKubenet)) - { - builder.Append(" allowNetworkPluginKubenet: "); - var boolValue = AllowNetworkPluginKubenet.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserAssignedIdentities), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" userAssignedIdentities: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(UserAssignedIdentities)) - { - if (UserAssignedIdentities.Any()) - { - builder.Append(" userAssignedIdentities: "); - builder.AppendLine("["); - foreach (var item in UserAssignedIdentities) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " userAssignedIdentities: "); - } - builder.AppendLine(" ]"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserAssignedIdentityExceptions), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" userAssignedIdentityExceptions: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(UserAssignedIdentityExceptions)) - { - if (UserAssignedIdentityExceptions.Any()) - { - builder.Append(" userAssignedIdentityExceptions: "); - builder.AppendLine("["); - foreach (var item in UserAssignedIdentityExceptions) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " userAssignedIdentityExceptions: "); - } - 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(ManagedClusterPodIdentityProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterPodIdentityProfile 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); - return DeserializeManagedClusterPodIdentityProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentityProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs deleted file mode 100644 index 5e6f022dfefc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProfile.cs +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -{ - /// See [use AAD pod identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity) for more details on pod identity integration. - public partial class ManagedClusterPodIdentityProfile - { - /// - /// 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 ManagedClusterPodIdentityProfile() - { - UserAssignedIdentities = new ChangeTrackingList(); - UserAssignedIdentityExceptions = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Whether the pod identity addon is enabled. - /// Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. - /// The pod identities to use in the cluster. - /// The pod identity exceptions to allow. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterPodIdentityProfile(bool? isEnabled, bool? allowNetworkPluginKubenet, IList userAssignedIdentities, IList userAssignedIdentityExceptions, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - AllowNetworkPluginKubenet = allowNetworkPluginKubenet; - UserAssignedIdentities = userAssignedIdentities; - UserAssignedIdentityExceptions = userAssignedIdentityExceptions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether the pod identity addon is enabled. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - /// Running in Kubenet is disabled by default due to the security related nature of AAD Pod Identity and the risks of IP spoofing. See [using Kubenet network plugin with AAD Pod Identity](https://docs.microsoft.com/azure/aks/use-azure-ad-pod-identity#using-kubenet-network-plugin-with-azure-active-directory-pod-managed-identities) for more information. - [WirePath("allowNetworkPluginKubenet")] - public bool? AllowNetworkPluginKubenet { get; set; } - /// The pod identities to use in the cluster. - [WirePath("userAssignedIdentities")] - public IList UserAssignedIdentities { get; } - /// The pod identity exceptions to allow. - [WirePath("userAssignedIdentityExceptions")] - public IList UserAssignedIdentityExceptions { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs deleted file mode 100644 index deaa8bddc9bf..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningError.Serialization.cs +++ /dev/null @@ -1,166 +0,0 @@ -// 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 ManagedClusterPodIdentityProvisioningError : 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(ManagedClusterPodIdentityProvisioningError)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(ErrorDetail)) - { - writer.WritePropertyName("error"u8); - JsonSerializer.Serialize(writer, ErrorDetail); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterPodIdentityProvisioningError 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(ManagedClusterPodIdentityProvisioningError)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPodIdentityProvisioningError(document.RootElement, options); - } - - internal static ManagedClusterPodIdentityProvisioningError DeserializeManagedClusterPodIdentityProvisioningError(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResponseError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - 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 ManagedClusterPodIdentityProvisioningError(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(ErrorDetail), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" error: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ErrorDetail)) - { - builder.Append(" error: "); - BicepSerializationHelpers.AppendChildObject(builder, ErrorDetail, 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(ManagedClusterPodIdentityProvisioningError)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterPodIdentityProvisioningError 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); - return DeserializeManagedClusterPodIdentityProvisioningError(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentityProvisioningError)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs deleted file mode 100644 index b869d7e2128c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.Serialization.cs +++ /dev/null @@ -1,169 +0,0 @@ -// 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 ManagedClusterPodIdentityProvisioningInfo : 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(ManagedClusterPodIdentityProvisioningInfo)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Error)) - { - writer.WritePropertyName("error"u8); - writer.WriteObjectValue(Error, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterPodIdentityProvisioningInfo 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(ManagedClusterPodIdentityProvisioningInfo)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPodIdentityProvisioningInfo(document.RootElement, options); - } - - internal static ManagedClusterPodIdentityProvisioningInfo DeserializeManagedClusterPodIdentityProvisioningInfo(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterPodIdentityProvisioningError error = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - error = ManagedClusterPodIdentityProvisioningError.DeserializeManagedClusterPodIdentityProvisioningError(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPodIdentityProvisioningInfo(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("ErrorDetail", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" error: "); - builder.AppendLine("{"); - builder.Append(" error: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - 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(ManagedClusterPodIdentityProvisioningInfo)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterPodIdentityProvisioningInfo 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); - return DeserializeManagedClusterPodIdentityProvisioningInfo(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentityProvisioningInfo)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs deleted file mode 100644 index d5d32dac995d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningInfo.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 ManagedClusterPodIdentityProvisioningInfo. - internal partial class ManagedClusterPodIdentityProvisioningInfo - { - /// - /// 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 ManagedClusterPodIdentityProvisioningInfo() - { - } - - /// Initializes a new instance of . - /// Pod identity assignment error (if any). - /// Keeps track of any properties unknown to the library. - internal ManagedClusterPodIdentityProvisioningInfo(ManagedClusterPodIdentityProvisioningError error, IDictionary serializedAdditionalRawData) - { - Error = error; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Pod identity assignment error (if any). - internal ManagedClusterPodIdentityProvisioningError Error { get; } - /// Details about the error. - [WirePath("error.error")] - public ResponseError ErrorDetail - { - get => Error?.ErrorDetail; - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningState.cs deleted file mode 100644 index 9219572f002e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentityProvisioningState.cs +++ /dev/null @@ -1,63 +0,0 @@ -// 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 pod identity. - public readonly partial struct ManagedClusterPodIdentityProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterPodIdentityProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AssignedValue = "Assigned"; - private const string CanceledValue = "Canceled"; - private const string DeletingValue = "Deleting"; - private const string FailedValue = "Failed"; - private const string SucceededValue = "Succeeded"; - private const string UpdatingValue = "Updating"; - - /// Assigned. - public static ManagedClusterPodIdentityProvisioningState Assigned { get; } = new ManagedClusterPodIdentityProvisioningState(AssignedValue); - /// Canceled. - public static ManagedClusterPodIdentityProvisioningState Canceled { get; } = new ManagedClusterPodIdentityProvisioningState(CanceledValue); - /// Deleting. - public static ManagedClusterPodIdentityProvisioningState Deleting { get; } = new ManagedClusterPodIdentityProvisioningState(DeletingValue); - /// Failed. - public static ManagedClusterPodIdentityProvisioningState Failed { get; } = new ManagedClusterPodIdentityProvisioningState(FailedValue); - /// Succeeded. - public static ManagedClusterPodIdentityProvisioningState Succeeded { get; } = new ManagedClusterPodIdentityProvisioningState(SucceededValue); - /// Updating. - public static ManagedClusterPodIdentityProvisioningState Updating { get; } = new ManagedClusterPodIdentityProvisioningState(UpdatingValue); - /// Determines if two values are the same. - public static bool operator ==(ManagedClusterPodIdentityProvisioningState left, ManagedClusterPodIdentityProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedClusterPodIdentityProvisioningState left, ManagedClusterPodIdentityProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterPodIdentityProvisioningState(string value) => new ManagedClusterPodIdentityProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterPodIdentityProvisioningState other && Equals(other); - /// - public bool Equals(ManagedClusterPodIdentityProvisioningState 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/ManagedClusterPoolUpgradeProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs deleted file mode 100644 index bae6b2db4cc7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.cs +++ /dev/null @@ -1,94 +0,0 @@ -// 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 list of available upgrade versions. - public partial class ManagedClusterPoolUpgradeProfile - { - /// - /// 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 Kubernetes version (major.minor.patch). - /// The operating system type. The default is Linux. - /// is null. - internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, ContainerServiceOSType osType) - { - Argument.AssertNotNull(kubernetesVersion, nameof(kubernetesVersion)); - - KubernetesVersion = kubernetesVersion; - OSType = osType; - Upgrades = new ChangeTrackingList(); - } - - /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterPoolUpgradeProfile(string kubernetesVersion, string name, ContainerServiceOSType osType, IReadOnlyList upgrades, IDictionary serializedAdditionalRawData) - { - KubernetesVersion = kubernetesVersion; - Name = name; - OSType = osType; - Upgrades = upgrades; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterPoolUpgradeProfile() - { - } - - /// The Kubernetes version (major.minor.patch). - [WirePath("kubernetesVersion")] - public string KubernetesVersion { get; } - /// The Agent Pool name. - [WirePath("name")] - public string Name { get; } - /// The operating system type. The default is Linux. - [WirePath("osType")] - public ContainerServiceOSType OSType { get; } - /// List of orchestrator types and versions available for upgrade. - [WirePath("upgrades")] - public IReadOnlyList Upgrades { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs deleted file mode 100644 index 3ee85c537575..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.cs +++ /dev/null @@ -1,86 +0,0 @@ -// 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 run command request. - public partial class ManagedClusterRunCommandContent - { - /// - /// 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 command to run. - /// is null. - public ManagedClusterRunCommandContent(string command) - { - Argument.AssertNotNull(command, nameof(command)); - - Command = command; - } - - /// Initializes a new instance of . - /// The command to run. - /// A base64 encoded zip file containing the files required by the command. - /// AuthToken issued for AKS AAD Server App. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterRunCommandContent(string command, string context, string clusterToken, IDictionary serializedAdditionalRawData) - { - Command = command; - Context = context; - ClusterToken = clusterToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterRunCommandContent() - { - } - - /// The command to run. - [WirePath("command")] - public string Command { get; } - /// A base64 encoded zip file containing the files required by the command. - [WirePath("context")] - public string Context { get; set; } - /// AuthToken issued for AKS AAD Server App. - [WirePath("clusterToken")] - public string ClusterToken { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs deleted file mode 100644 index 264b88600404..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.Serialization.cs +++ /dev/null @@ -1,390 +0,0 @@ -// 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 ManagedClusterRunCommandResult : 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(ManagedClusterRunCommandResult)} does not support writing '{format}' format."); - } - - if (options.Format != "W" && Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("properties"u8); - writer.WriteStartObject(); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) - { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState); - } - if (options.Format != "W" && Optional.IsDefined(ExitCode)) - { - writer.WritePropertyName("exitCode"u8); - writer.WriteNumberValue(ExitCode.Value); - } - if (options.Format != "W" && Optional.IsDefined(StartedOn)) - { - writer.WritePropertyName("startedAt"u8); - writer.WriteStringValue(StartedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(FinishedOn)) - { - writer.WritePropertyName("finishedAt"u8); - writer.WriteStringValue(FinishedOn.Value, "O"); - } - if (options.Format != "W" && Optional.IsDefined(Logs)) - { - writer.WritePropertyName("logs"u8); - writer.WriteStringValue(Logs); - } - if (options.Format != "W" && Optional.IsDefined(Reason)) - { - writer.WritePropertyName("reason"u8); - writer.WriteStringValue(Reason); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterRunCommandResult 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(ManagedClusterRunCommandResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterRunCommandResult(document.RootElement, options); - } - - internal static ManagedClusterRunCommandResult DeserializeManagedClusterRunCommandResult(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string id = default; - string provisioningState = default; - int? exitCode = default; - DateTimeOffset? startedAt = default; - DateTimeOffset? finishedAt = default; - string logs = default; - string reason = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetString(); - 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("provisioningState"u8)) - { - provisioningState = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("exitCode"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - exitCode = property0.Value.GetInt32(); - continue; - } - if (property0.NameEquals("startedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - startedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("finishedAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - finishedAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - if (property0.NameEquals("logs"u8)) - { - logs = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("reason"u8)) - { - reason = property0.Value.GetString(); - continue; - } - } - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterRunCommandResult( - id, - provisioningState, - exitCode, - startedAt, - finishedAt, - logs, - reason, - 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: "); - if (Id.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Id}'''"); - } - else - { - builder.AppendLine($"'{Id}'"); - } - } - } - - builder.Append(" properties:"); - 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: "); - if (ProvisioningState.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ProvisioningState}'''"); - } - else - { - builder.AppendLine($"'{ProvisioningState}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExitCode), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" exitCode: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ExitCode)) - { - builder.Append(" exitCode: "); - builder.AppendLine($"{ExitCode.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartedOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" startedAt: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(StartedOn)) - { - builder.Append(" startedAt: "); - var formattedDateTimeString = TypeFormatters.ToString(StartedOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FinishedOn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" finishedAt: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FinishedOn)) - { - builder.Append(" finishedAt: "); - var formattedDateTimeString = TypeFormatters.ToString(FinishedOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Logs), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" logs: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Logs)) - { - builder.Append(" logs: "); - if (Logs.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Logs}'''"); - } - else - { - builder.AppendLine($"'{Logs}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reason), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" reason: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Reason)) - { - builder.Append(" reason: "); - if (Reason.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Reason}'''"); - } - else - { - builder.AppendLine($"'{Reason}'"); - } - } - } - - 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(ManagedClusterRunCommandResult)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterRunCommandResult 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); - return DeserializeManagedClusterRunCommandResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterRunCommandResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs deleted file mode 100644 index a28ac6140324..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandResult.cs +++ /dev/null @@ -1,96 +0,0 @@ -// 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 -{ - /// run command result. - public partial class ManagedClusterRunCommandResult - { - /// - /// 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 ManagedClusterRunCommandResult() - { - } - - /// Initializes a new instance of . - /// The command id. - /// provisioning State. - /// The exit code of the command. - /// The time when the command started. - /// The time when the command finished. - /// The command output. - /// An explanation of why provisioningState is set to failed (if so). - /// Keeps track of any properties unknown to the library. - internal ManagedClusterRunCommandResult(string id, string provisioningState, int? exitCode, DateTimeOffset? startedOn, DateTimeOffset? finishedOn, string logs, string reason, IDictionary serializedAdditionalRawData) - { - Id = id; - ProvisioningState = provisioningState; - ExitCode = exitCode; - StartedOn = startedOn; - FinishedOn = finishedOn; - Logs = logs; - Reason = reason; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The command id. - [WirePath("id")] - public string Id { get; } - /// provisioning State. - [WirePath("properties.provisioningState")] - public string ProvisioningState { get; } - /// The exit code of the command. - [WirePath("properties.exitCode")] - public int? ExitCode { get; } - /// The time when the command started. - [WirePath("properties.startedAt")] - public DateTimeOffset? StartedOn { get; } - /// The time when the command finished. - [WirePath("properties.finishedAt")] - public DateTimeOffset? FinishedOn { get; } - /// The command output. - [WirePath("properties.logs")] - public string Logs { get; } - /// An explanation of why provisioningState is set to failed (if so). - [WirePath("properties.reason")] - public string Reason { 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 deleted file mode 100644 index 40d208c02228..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.Serialization.cs +++ /dev/null @@ -1,259 +0,0 @@ -// 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 ManagedClusterSecurityProfile : 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(ManagedClusterSecurityProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Defender)) - { - writer.WritePropertyName("defender"u8); - writer.WriteObjectValue(Defender, options); - } - if (Optional.IsDefined(AzureKeyVaultKms)) - { - writer.WritePropertyName("azureKeyVaultKms"u8); - writer.WriteObjectValue(AzureKeyVaultKms, options); - } - if (Optional.IsDefined(WorkloadIdentity)) - { - writer.WritePropertyName("workloadIdentity"u8); - writer.WriteObjectValue(WorkloadIdentity, options); - } - if (Optional.IsDefined(ImageCleaner)) - { - writer.WritePropertyName("imageCleaner"u8); - writer.WriteObjectValue(ImageCleaner, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfile 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(ManagedClusterSecurityProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfile(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfile DeserializeManagedClusterSecurityProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterSecurityProfileDefender defender = default; - ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms = default; - ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity = default; - ManagedClusterSecurityProfileImageCleaner imageCleaner = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("defender"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - defender = ManagedClusterSecurityProfileDefender.DeserializeManagedClusterSecurityProfileDefender(property.Value, options); - continue; - } - if (property.NameEquals("azureKeyVaultKms"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - azureKeyVaultKms = ManagedClusterSecurityProfileKeyVaultKms.DeserializeManagedClusterSecurityProfileKeyVaultKms(property.Value, options); - continue; - } - if (property.NameEquals("workloadIdentity"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - workloadIdentity = ManagedClusterSecurityProfileWorkloadIdentity.DeserializeManagedClusterSecurityProfileWorkloadIdentity(property.Value, options); - continue; - } - if (property.NameEquals("imageCleaner"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - imageCleaner = ManagedClusterSecurityProfileImageCleaner.DeserializeManagedClusterSecurityProfileImageCleaner(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfile(defender, azureKeyVaultKms, workloadIdentity, imageCleaner, 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(Defender), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" defender: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Defender)) - { - builder.Append(" defender: "); - BicepSerializationHelpers.AppendChildObject(builder, Defender, options, 2, false, " defender: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AzureKeyVaultKms), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" azureKeyVaultKms: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AzureKeyVaultKms)) - { - builder.Append(" azureKeyVaultKms: "); - BicepSerializationHelpers.AppendChildObject(builder, AzureKeyVaultKms, options, 2, false, " azureKeyVaultKms: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsWorkloadIdentityEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" workloadIdentity: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(WorkloadIdentity)) - { - builder.Append(" workloadIdentity: "); - BicepSerializationHelpers.AppendChildObject(builder, WorkloadIdentity, options, 2, false, " workloadIdentity: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ImageCleaner), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" imageCleaner: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ImageCleaner)) - { - builder.Append(" imageCleaner: "); - BicepSerializationHelpers.AppendChildObject(builder, ImageCleaner, options, 2, false, " imageCleaner: "); - } - } - - 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(ManagedClusterSecurityProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfile 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); - return DeserializeManagedClusterSecurityProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs deleted file mode 100644 index 65d99a578005..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfile.cs +++ /dev/null @@ -1,93 +0,0 @@ -// 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 for the container service cluster. - public partial class ManagedClusterSecurityProfile - { - /// - /// 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 ManagedClusterSecurityProfile() - { - } - - /// Initializes a new instance of . - /// Microsoft Defender settings for the security profile. - /// 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfile(ManagedClusterSecurityProfileDefender defender, ManagedClusterSecurityProfileKeyVaultKms azureKeyVaultKms, ManagedClusterSecurityProfileWorkloadIdentity workloadIdentity, ManagedClusterSecurityProfileImageCleaner imageCleaner, IDictionary serializedAdditionalRawData) - { - Defender = defender; - AzureKeyVaultKms = azureKeyVaultKms; - WorkloadIdentity = workloadIdentity; - ImageCleaner = imageCleaner; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Microsoft Defender settings for the security profile. - [WirePath("defender")] - public ManagedClusterSecurityProfileDefender Defender { get; set; } - /// Azure Key Vault [key management service](https://kubernetes.io/docs/tasks/administer-cluster/kms-provider/) settings for the security profile. - [WirePath("azureKeyVaultKms")] - public ManagedClusterSecurityProfileKeyVaultKms AzureKeyVaultKms { get; set; } - /// 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. - internal ManagedClusterSecurityProfileWorkloadIdentity WorkloadIdentity { get; set; } - /// Whether to enable workload identity. - [WirePath("workloadIdentity.enabled")] - public bool? IsWorkloadIdentityEnabled - { - get => WorkloadIdentity is null ? default : WorkloadIdentity.IsWorkloadIdentityEnabled; - set - { - if (WorkloadIdentity is null) - WorkloadIdentity = new ManagedClusterSecurityProfileWorkloadIdentity(); - WorkloadIdentity.IsWorkloadIdentityEnabled = value; - } - } - - /// Image Cleaner settings for the security profile. - [WirePath("imageCleaner")] - public ManagedClusterSecurityProfileImageCleaner ImageCleaner { get; set; } - } -} 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 deleted file mode 100644 index 1c8364d19964..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.Serialization.cs +++ /dev/null @@ -1,199 +0,0 @@ -// 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 ManagedClusterSecurityProfileDefender : 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(ManagedClusterSecurityProfileDefender)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LogAnalyticsWorkspaceResourceId)) - { - writer.WritePropertyName("logAnalyticsWorkspaceResourceId"u8); - writer.WriteStringValue(LogAnalyticsWorkspaceResourceId); - } - if (Optional.IsDefined(SecurityMonitoring)) - { - writer.WritePropertyName("securityMonitoring"u8); - writer.WriteObjectValue(SecurityMonitoring, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfileDefender 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(ManagedClusterSecurityProfileDefender)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfileDefender(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfileDefender DeserializeManagedClusterSecurityProfileDefender(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ResourceIdentifier logAnalyticsWorkspaceResourceId = default; - ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - logAnalyticsWorkspaceResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("securityMonitoring"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - securityMonitoring = ManagedClusterSecurityProfileDefenderSecurityMonitoring.DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(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); - } - - 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(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("IsSecurityMonitoringEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" securityMonitoring: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(SecurityMonitoring)) - { - builder.Append(" securityMonitoring: "); - BicepSerializationHelpers.AppendChildObject(builder, SecurityMonitoring, options, 2, false, " securityMonitoring: "); - } - } - - 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(ManagedClusterSecurityProfileDefender)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfileDefender 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); - return DeserializeManagedClusterSecurityProfileDefender(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefender)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs deleted file mode 100644 index 03554a08f363..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefender.cs +++ /dev/null @@ -1,83 +0,0 @@ -// 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 -{ - /// Microsoft Defender settings for the security profile. - public partial class ManagedClusterSecurityProfileDefender - { - /// - /// 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 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. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileDefender(ResourceIdentifier logAnalyticsWorkspaceResourceId, ManagedClusterSecurityProfileDefenderSecurityMonitoring securityMonitoring, IDictionary serializedAdditionalRawData) - { - LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; - SecurityMonitoring = securityMonitoring; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// 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. - [WirePath("logAnalyticsWorkspaceResourceId")] - public ResourceIdentifier LogAnalyticsWorkspaceResourceId { get; set; } - /// Microsoft Defender threat detection for Cloud settings for the security profile. - internal ManagedClusterSecurityProfileDefenderSecurityMonitoring SecurityMonitoring { get; set; } - /// Whether to enable Defender threat detection. - [WirePath("securityMonitoring.enabled")] - public bool? IsSecurityMonitoringEnabled - { - get => SecurityMonitoring is null ? default : SecurityMonitoring.IsSecurityMonitoringEnabled; - set - { - if (SecurityMonitoring is null) - SecurityMonitoring = new ManagedClusterSecurityProfileDefenderSecurityMonitoring(); - SecurityMonitoring.IsSecurityMonitoringEnabled = value; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs deleted file mode 100644 index 2976d4f5ecc4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterSecurityProfileDefenderSecurityMonitoring : 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(ManagedClusterSecurityProfileDefenderSecurityMonitoring)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsSecurityMonitoringEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsSecurityMonitoringEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfileDefenderSecurityMonitoring 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(ManagedClusterSecurityProfileDefenderSecurityMonitoring)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfileDefenderSecurityMonitoring DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(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 ManagedClusterSecurityProfileDefenderSecurityMonitoring(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(IsSecurityMonitoringEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsSecurityMonitoringEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsSecurityMonitoringEnabled.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(ManagedClusterSecurityProfileDefenderSecurityMonitoring)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfileDefenderSecurityMonitoring 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); - return DeserializeManagedClusterSecurityProfileDefenderSecurityMonitoring(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileDefenderSecurityMonitoring)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs deleted file mode 100644 index 75872200f3c2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileDefenderSecurityMonitoring.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 the security profile threat detection. - internal partial class ManagedClusterSecurityProfileDefenderSecurityMonitoring - { - /// - /// 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 ManagedClusterSecurityProfileDefenderSecurityMonitoring() - { - } - - /// Initializes a new instance of . - /// Whether to enable Defender threat detection. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileDefenderSecurityMonitoring(bool? isSecurityMonitoringEnabled, IDictionary serializedAdditionalRawData) - { - IsSecurityMonitoringEnabled = isSecurityMonitoringEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable Defender threat detection. - [WirePath("enabled")] - public bool? IsSecurityMonitoringEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs deleted file mode 100644 index a4871ab40074..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.Serialization.cs +++ /dev/null @@ -1,197 +0,0 @@ -// 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 ManagedClusterSecurityProfileImageCleaner : 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(ManagedClusterSecurityProfileImageCleaner)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(IntervalHours)) - { - writer.WritePropertyName("intervalHours"u8); - writer.WriteNumberValue(IntervalHours.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfileImageCleaner 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(ManagedClusterSecurityProfileImageCleaner)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfileImageCleaner(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfileImageCleaner DeserializeManagedClusterSecurityProfileImageCleaner(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? enabled = default; - int? intervalHours = 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("intervalHours"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - intervalHours = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfileImageCleaner(enabled, intervalHours, 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IntervalHours), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" intervalHours: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IntervalHours)) - { - builder.Append(" intervalHours: "); - builder.AppendLine($"{IntervalHours.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(ManagedClusterSecurityProfileImageCleaner)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfileImageCleaner 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); - return DeserializeManagedClusterSecurityProfileImageCleaner(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileImageCleaner)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs deleted file mode 100644 index ec722117c3bf..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileImageCleaner.cs +++ /dev/null @@ -1,71 +0,0 @@ -// 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 Cleaner removes unused images from nodes, freeing up disk space and helping to reduce attack surface area. Here are settings for the security profile. - public partial class ManagedClusterSecurityProfileImageCleaner - { - /// - /// 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 ManagedClusterSecurityProfileImageCleaner() - { - } - - /// Initializes a new instance of . - /// Whether to enable Image Cleaner on AKS cluster. - /// Image Cleaner scanning interval in hours. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileImageCleaner(bool? isEnabled, int? intervalHours, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - IntervalHours = intervalHours; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable Image Cleaner on AKS cluster. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - /// Image Cleaner scanning interval in hours. - [WirePath("intervalHours")] - public int? IntervalHours { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs deleted file mode 100644 index 89f0d96aebf3..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.Serialization.cs +++ /dev/null @@ -1,261 +0,0 @@ -// 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 ManagedClusterSecurityProfileKeyVaultKms : 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(ManagedClusterSecurityProfileKeyVaultKms)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(KeyId)) - { - writer.WritePropertyName("keyId"u8); - writer.WriteStringValue(KeyId); - } - if (Optional.IsDefined(KeyVaultNetworkAccess)) - { - writer.WritePropertyName("keyVaultNetworkAccess"u8); - writer.WriteStringValue(KeyVaultNetworkAccess.Value.ToString()); - } - if (Optional.IsDefined(KeyVaultResourceId)) - { - writer.WritePropertyName("keyVaultResourceId"u8); - writer.WriteStringValue(KeyVaultResourceId); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfileKeyVaultKms 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(ManagedClusterSecurityProfileKeyVaultKms)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfileKeyVaultKms(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfileKeyVaultKms DeserializeManagedClusterSecurityProfileKeyVaultKms(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? enabled = default; - string keyId = default; - ManagedClusterKeyVaultNetworkAccessType? keyVaultNetworkAccess = default; - ResourceIdentifier keyVaultResourceId = 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("keyId"u8)) - { - keyId = property.Value.GetString(); - continue; - } - if (property.NameEquals("keyVaultNetworkAccess"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultNetworkAccess = new ManagedClusterKeyVaultNetworkAccessType(property.Value.GetString()); - continue; - } - if (property.NameEquals("keyVaultResourceId"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keyVaultResourceId = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterSecurityProfileKeyVaultKms(enabled, keyId, keyVaultNetworkAccess, keyVaultResourceId, 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keyId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KeyId)) - { - builder.Append(" keyId: "); - if (KeyId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{KeyId}'''"); - } - else - { - builder.AppendLine($"'{KeyId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultNetworkAccess), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keyVaultNetworkAccess: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KeyVaultNetworkAccess)) - { - builder.Append(" keyVaultNetworkAccess: "); - builder.AppendLine($"'{KeyVaultNetworkAccess.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultResourceId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keyVaultResourceId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KeyVaultResourceId)) - { - builder.Append(" keyVaultResourceId: "); - builder.AppendLine($"'{KeyVaultResourceId.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(ManagedClusterSecurityProfileKeyVaultKms)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfileKeyVaultKms 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); - return DeserializeManagedClusterSecurityProfileKeyVaultKms(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileKeyVaultKms)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs deleted file mode 100644 index 8d14f8307789..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileKeyVaultKms.cs +++ /dev/null @@ -1,82 +0,0 @@ -// 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 Key Vault key management service settings for the security profile. - public partial class ManagedClusterSecurityProfileKeyVaultKms - { - /// - /// 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 ManagedClusterSecurityProfileKeyVaultKms() - { - } - - /// Initializes a new instance of . - /// Whether to enable Azure Key Vault key management service. The default is false. - /// Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty. - /// Network access of key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. The default value is `Public`. - /// Resource ID of key vault. When keyVaultNetworkAccess is `Private`, this field is required and must be a valid resource ID. When keyVaultNetworkAccess is `Public`, leave the field empty. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileKeyVaultKms(bool? isEnabled, string keyId, ManagedClusterKeyVaultNetworkAccessType? keyVaultNetworkAccess, ResourceIdentifier keyVaultResourceId, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - KeyId = keyId; - KeyVaultNetworkAccess = keyVaultNetworkAccess; - KeyVaultResourceId = keyVaultResourceId; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable Azure Key Vault key management service. The default is false. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - /// Identifier of Azure Key Vault key. See [key identifier format](https://docs.microsoft.com/en-us/azure/key-vault/general/about-keys-secrets-certificates#vault-name-and-object-name) for more details. When Azure Key Vault key management service is enabled, this field is required and must be a valid key identifier. When Azure Key Vault key management service is disabled, leave the field empty. - [WirePath("keyId")] - public string KeyId { get; set; } - /// Network access of key vault. The possible values are `Public` and `Private`. `Public` means the key vault allows public access from all networks. `Private` means the key vault disables public access and enables private link. The default value is `Public`. - [WirePath("keyVaultNetworkAccess")] - public ManagedClusterKeyVaultNetworkAccessType? KeyVaultNetworkAccess { get; set; } - /// Resource ID of key vault. When keyVaultNetworkAccess is `Private`, this field is required and must be a valid resource ID. When keyVaultNetworkAccess is `Public`, leave the field empty. - [WirePath("keyVaultResourceId")] - public ResourceIdentifier KeyVaultResourceId { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs deleted file mode 100644 index 6e9f24adb8e2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterSecurityProfileWorkloadIdentity : 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(ManagedClusterSecurityProfileWorkloadIdentity)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsWorkloadIdentityEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsWorkloadIdentityEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterSecurityProfileWorkloadIdentity 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(ManagedClusterSecurityProfileWorkloadIdentity)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterSecurityProfileWorkloadIdentity(document.RootElement, options); - } - - internal static ManagedClusterSecurityProfileWorkloadIdentity DeserializeManagedClusterSecurityProfileWorkloadIdentity(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 ManagedClusterSecurityProfileWorkloadIdentity(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(IsWorkloadIdentityEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsWorkloadIdentityEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsWorkloadIdentityEnabled.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(ManagedClusterSecurityProfileWorkloadIdentity)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterSecurityProfileWorkloadIdentity 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); - return DeserializeManagedClusterSecurityProfileWorkloadIdentity(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterSecurityProfileWorkloadIdentity)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs deleted file mode 100644 index fcde5ae1ad31..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSecurityProfileWorkloadIdentity.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// Workload identity settings for the security profile. - internal partial class ManagedClusterSecurityProfileWorkloadIdentity - { - /// - /// 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 ManagedClusterSecurityProfileWorkloadIdentity() - { - } - - /// Initializes a new instance of . - /// Whether to enable workload identity. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterSecurityProfileWorkloadIdentity(bool? isWorkloadIdentityEnabled, IDictionary serializedAdditionalRawData) - { - IsWorkloadIdentityEnabled = isWorkloadIdentityEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable workload identity. - [WirePath("enabled")] - public bool? IsWorkloadIdentityEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs deleted file mode 100644 index 7f1552d66f23..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.Serialization.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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 ManagedClusterServicePrincipalProfile : 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(ManagedClusterServicePrincipalProfile)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - if (Optional.IsDefined(Secret)) - { - writer.WritePropertyName("secret"u8); - writer.WriteStringValue(Secret); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterServicePrincipalProfile 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(ManagedClusterServicePrincipalProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterServicePrincipalProfile(document.RootElement, options); - } - - internal static ManagedClusterServicePrincipalProfile DeserializeManagedClusterServicePrincipalProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string clientId = default; - string secret = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("clientId"u8)) - { - clientId = property.Value.GetString(); - continue; - } - if (property.NameEquals("secret"u8)) - { - secret = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterServicePrincipalProfile(clientId, secret, 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(ClientId), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" clientId: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(ClientId)) - { - builder.Append(" clientId: "); - if (ClientId.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ClientId}'''"); - } - else - { - builder.AppendLine($"'{ClientId}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Secret), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" secret: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Secret)) - { - builder.Append(" secret: "); - if (Secret.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Secret}'''"); - } - else - { - builder.AppendLine($"'{Secret}'"); - } - } - } - - 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(ManagedClusterServicePrincipalProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterServicePrincipalProfile 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); - return DeserializeManagedClusterServicePrincipalProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterServicePrincipalProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs deleted file mode 100644 index ff0d3a329ae4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuName.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 name of a managed cluster SKU. - public readonly partial struct ManagedClusterSkuName : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterSkuName(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string BaseValue = "Base"; - - /// Base option for the AKS control plane. - public static ManagedClusterSkuName Base { get; } = new ManagedClusterSkuName(BaseValue); - /// 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. - public static bool operator !=(ManagedClusterSkuName left, ManagedClusterSkuName right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterSkuName(string value) => new ManagedClusterSkuName(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterSkuName other && Equals(other); - /// - public bool Equals(ManagedClusterSkuName 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/ManagedClusterSkuTier.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuTier.cs deleted file mode 100644 index 479e2adfb6e9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSkuTier.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// If not specified, the default is 'Free'. See [AKS Pricing Tier](https://learn.microsoft.com/azure/aks/free-standard-pricing-tiers) for more details. - public readonly partial struct ManagedClusterSkuTier : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedClusterSkuTier(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string PremiumValue = "Premium"; - private const string StandardValue = "Standard"; - private const string FreeValue = "Free"; - - /// Cluster has premium capabilities in addition to all of the capabilities included in 'Standard'. Premium enables selection of LongTermSupport (aka.ms/aks/lts) for certain Kubernetes versions. - public static ManagedClusterSkuTier Premium { get; } = new ManagedClusterSkuTier(PremiumValue); - /// Recommended for mission-critical and production workloads. Includes Kubernetes control plane autoscaling, workload-intensive testing, and up to 5,000 nodes per cluster. Guarantees 99.95% availability of the Kubernetes API server endpoint for clusters that use Availability Zones and 99.9% of availability for clusters that don't use Availability Zones. - public static ManagedClusterSkuTier Standard { get; } = new ManagedClusterSkuTier(StandardValue); - /// The cluster management is free, but charged for VM, storage, and networking usage. Best for experimenting, learning, simple testing, or workloads with fewer than 10 nodes. Not recommended for production use cases. - public static ManagedClusterSkuTier Free { get; } = new ManagedClusterSkuTier(FreeValue); - /// Determines if two values are the same. - public static bool operator ==(ManagedClusterSkuTier left, ManagedClusterSkuTier right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedClusterSkuTier left, ManagedClusterSkuTier right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedClusterSkuTier(string value) => new ManagedClusterSkuTier(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedClusterSkuTier other && Equals(other); - /// - public bool Equals(ManagedClusterSkuTier 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/ManagedClusterStorageProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs deleted file mode 100644 index 183e6f0f384e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.Serialization.cs +++ /dev/null @@ -1,268 +0,0 @@ -// 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 ManagedClusterStorageProfile : 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(ManagedClusterStorageProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(DiskCsiDriver)) - { - writer.WritePropertyName("diskCSIDriver"u8); - writer.WriteObjectValue(DiskCsiDriver, options); - } - if (Optional.IsDefined(FileCsiDriver)) - { - writer.WritePropertyName("fileCSIDriver"u8); - writer.WriteObjectValue(FileCsiDriver, options); - } - if (Optional.IsDefined(SnapshotController)) - { - writer.WritePropertyName("snapshotController"u8); - writer.WriteObjectValue(SnapshotController, options); - } - if (Optional.IsDefined(BlobCsiDriver)) - { - writer.WritePropertyName("blobCSIDriver"u8); - writer.WriteObjectValue(BlobCsiDriver, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterStorageProfile 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(ManagedClusterStorageProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterStorageProfile(document.RootElement, options); - } - - internal static ManagedClusterStorageProfile DeserializeManagedClusterStorageProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterStorageProfileDiskCsiDriver diskCsiDriver = default; - ManagedClusterStorageProfileFileCsiDriver fileCsiDriver = default; - ManagedClusterStorageProfileSnapshotController snapshotController = default; - ManagedClusterStorageProfileBlobCsiDriver blobCsiDriver = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("diskCSIDriver"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - diskCsiDriver = ManagedClusterStorageProfileDiskCsiDriver.DeserializeManagedClusterStorageProfileDiskCsiDriver(property.Value, options); - continue; - } - if (property.NameEquals("fileCSIDriver"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fileCsiDriver = ManagedClusterStorageProfileFileCsiDriver.DeserializeManagedClusterStorageProfileFileCsiDriver(property.Value, options); - continue; - } - if (property.NameEquals("snapshotController"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - snapshotController = ManagedClusterStorageProfileSnapshotController.DeserializeManagedClusterStorageProfileSnapshotController(property.Value, options); - continue; - } - if (property.NameEquals("blobCSIDriver"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - blobCsiDriver = ManagedClusterStorageProfileBlobCsiDriver.DeserializeManagedClusterStorageProfileBlobCsiDriver(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterStorageProfile(diskCsiDriver, fileCsiDriver, snapshotController, blobCsiDriver, 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("IsEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" diskCSIDriver: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(DiskCsiDriver)) - { - builder.Append(" diskCSIDriver: "); - BicepSerializationHelpers.AppendChildObject(builder, DiskCsiDriver, options, 2, false, " diskCSIDriver: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fileCSIDriver: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(FileCsiDriver)) - { - builder.Append(" fileCSIDriver: "); - BicepSerializationHelpers.AppendChildObject(builder, FileCsiDriver, options, 2, false, " fileCSIDriver: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" snapshotController: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(SnapshotController)) - { - builder.Append(" snapshotController: "); - BicepSerializationHelpers.AppendChildObject(builder, SnapshotController, options, 2, false, " snapshotController: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" blobCSIDriver: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(BlobCsiDriver)) - { - builder.Append(" blobCSIDriver: "); - BicepSerializationHelpers.AppendChildObject(builder, BlobCsiDriver, options, 2, false, " blobCSIDriver: "); - } - } - - 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(ManagedClusterStorageProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterStorageProfile 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); - return DeserializeManagedClusterStorageProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterStorageProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs deleted file mode 100644 index ea5c58a09885..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfile.cs +++ /dev/null @@ -1,80 +0,0 @@ -// 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 -{ - /// Storage profile for the container service cluster. - public partial class ManagedClusterStorageProfile - { - /// - /// 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 ManagedClusterStorageProfile() - { - } - - /// Initializes a new instance of . - /// AzureDisk CSI Driver settings for the storage profile. - /// AzureFile CSI Driver settings for the storage profile. - /// Snapshot Controller settings for the storage profile. - /// AzureBlob CSI Driver settings for the storage profile. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfile(ManagedClusterStorageProfileDiskCsiDriver diskCsiDriver, ManagedClusterStorageProfileFileCsiDriver fileCsiDriver, ManagedClusterStorageProfileSnapshotController snapshotController, ManagedClusterStorageProfileBlobCsiDriver blobCsiDriver, IDictionary serializedAdditionalRawData) - { - DiskCsiDriver = diskCsiDriver; - FileCsiDriver = fileCsiDriver; - SnapshotController = snapshotController; - BlobCsiDriver = blobCsiDriver; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// AzureDisk CSI Driver settings for the storage profile. - internal ManagedClusterStorageProfileDiskCsiDriver DiskCsiDriver { get; set; } - - /// AzureFile CSI Driver settings for the storage profile. - internal ManagedClusterStorageProfileFileCsiDriver FileCsiDriver { get; set; } - - /// Snapshot Controller settings for the storage profile. - internal ManagedClusterStorageProfileSnapshotController SnapshotController { get; set; } - - /// AzureBlob CSI Driver settings for the storage profile. - internal ManagedClusterStorageProfileBlobCsiDriver BlobCsiDriver { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs deleted file mode 100644 index d5cbafb5b469..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterStorageProfileBlobCsiDriver : 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(ManagedClusterStorageProfileBlobCsiDriver)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterStorageProfileBlobCsiDriver 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(ManagedClusterStorageProfileBlobCsiDriver)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterStorageProfileBlobCsiDriver(document.RootElement, options); - } - - internal static ManagedClusterStorageProfileBlobCsiDriver DeserializeManagedClusterStorageProfileBlobCsiDriver(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 ManagedClusterStorageProfileBlobCsiDriver(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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.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(ManagedClusterStorageProfileBlobCsiDriver)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterStorageProfileBlobCsiDriver 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); - return DeserializeManagedClusterStorageProfileBlobCsiDriver(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterStorageProfileBlobCsiDriver)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs deleted file mode 100644 index f8a629ddf0fd..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileBlobCsiDriver.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// AzureBlob CSI Driver settings for the storage profile. - internal partial class ManagedClusterStorageProfileBlobCsiDriver - { - /// - /// 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 ManagedClusterStorageProfileBlobCsiDriver() - { - } - - /// Initializes a new instance of . - /// Whether to enable AzureBlob CSI Driver. The default value is false. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfileBlobCsiDriver(bool? isEnabled, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable AzureBlob CSI Driver. The default value is false. - [WirePath("enabled")] - public bool? IsEnabled { 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 deleted file mode 100644 index 3d899a10b593..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterStorageProfileDiskCsiDriver : 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(ManagedClusterStorageProfileDiskCsiDriver)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterStorageProfileDiskCsiDriver 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(ManagedClusterStorageProfileDiskCsiDriver)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterStorageProfileDiskCsiDriver(document.RootElement, options); - } - - internal static ManagedClusterStorageProfileDiskCsiDriver DeserializeManagedClusterStorageProfileDiskCsiDriver(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 ManagedClusterStorageProfileDiskCsiDriver(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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.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(ManagedClusterStorageProfileDiskCsiDriver)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterStorageProfileDiskCsiDriver 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); - return DeserializeManagedClusterStorageProfileDiskCsiDriver(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterStorageProfileDiskCsiDriver)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs deleted file mode 100644 index 8e340b83d57c..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileDiskCsiDriver.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// AzureDisk CSI Driver settings for the storage profile. - internal partial class ManagedClusterStorageProfileDiskCsiDriver - { - /// - /// 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 ManagedClusterStorageProfileDiskCsiDriver() - { - } - - /// Initializes a new instance of . - /// Whether to enable AzureDisk CSI Driver. The default value is true. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfileDiskCsiDriver(bool? isEnabled, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable AzureDisk CSI Driver. The default value is true. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs deleted file mode 100644 index bc335387f4c2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterStorageProfileFileCsiDriver : 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(ManagedClusterStorageProfileFileCsiDriver)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterStorageProfileFileCsiDriver 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(ManagedClusterStorageProfileFileCsiDriver)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterStorageProfileFileCsiDriver(document.RootElement, options); - } - - internal static ManagedClusterStorageProfileFileCsiDriver DeserializeManagedClusterStorageProfileFileCsiDriver(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 ManagedClusterStorageProfileFileCsiDriver(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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.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(ManagedClusterStorageProfileFileCsiDriver)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterStorageProfileFileCsiDriver 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); - return DeserializeManagedClusterStorageProfileFileCsiDriver(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterStorageProfileFileCsiDriver)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs deleted file mode 100644 index 68410b49ac39..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileFileCsiDriver.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// AzureFile CSI Driver settings for the storage profile. - internal partial class ManagedClusterStorageProfileFileCsiDriver - { - /// - /// 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 ManagedClusterStorageProfileFileCsiDriver() - { - } - - /// Initializes a new instance of . - /// Whether to enable AzureFile CSI Driver. The default value is true. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfileFileCsiDriver(bool? isEnabled, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable AzureFile CSI Driver. The default value is true. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs deleted file mode 100644 index 2af1be253474..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.Serialization.cs +++ /dev/null @@ -1,167 +0,0 @@ -// 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 ManagedClusterStorageProfileSnapshotController : 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(ManagedClusterStorageProfileSnapshotController)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterStorageProfileSnapshotController 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(ManagedClusterStorageProfileSnapshotController)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterStorageProfileSnapshotController(document.RootElement, options); - } - - internal static ManagedClusterStorageProfileSnapshotController DeserializeManagedClusterStorageProfileSnapshotController(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 ManagedClusterStorageProfileSnapshotController(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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.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(ManagedClusterStorageProfileSnapshotController)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterStorageProfileSnapshotController 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); - return DeserializeManagedClusterStorageProfileSnapshotController(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterStorageProfileSnapshotController)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs deleted file mode 100644 index c2d458589783..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterStorageProfileSnapshotController.cs +++ /dev/null @@ -1,66 +0,0 @@ -// 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 -{ - /// Snapshot Controller settings for the storage profile. - internal partial class ManagedClusterStorageProfileSnapshotController - { - /// - /// 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 ManagedClusterStorageProfileSnapshotController() - { - } - - /// Initializes a new instance of . - /// Whether to enable Snapshot Controller. The default value is true. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterStorageProfileSnapshotController(bool? isEnabled, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Whether to enable Snapshot Controller. The default value is true. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.Serialization.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.Serialization.cs index 075e297b696d..cbd08a2c88c9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ServiceMeshProfile : IUtf8JsonSerializable, IJsonModel + public partial class ManagedClusterUpdate : 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,18 +29,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(ServiceMeshProfile)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpdate)} does not support writing '{format}' format."); } - writer.WritePropertyName("mode"u8); - writer.WriteStringValue(Mode.ToString()); - if (Optional.IsDefined(Istio)) + writer.WritePropertyName("upgrade"u8); + writer.WriteObjectValue(Upgrade, options); + if (Optional.IsDefined(NodeImageSelection)) { - writer.WritePropertyName("istio"u8); - writer.WriteObjectValue(Istio, options); + writer.WritePropertyName("nodeImageSelection"u8); + writer.WriteObjectValue(NodeImageSelection, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -59,19 +59,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ServiceMeshProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ManagedClusterUpdate 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(ServiceMeshProfile)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpdate)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeServiceMeshProfile(document.RootElement, options); + return DeserializeManagedClusterUpdate(document.RootElement, options); } - internal static ServiceMeshProfile DeserializeServiceMeshProfile(JsonElement element, ModelReaderWriterOptions options = null) + internal static ManagedClusterUpdate DeserializeManagedClusterUpdate(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,24 +79,24 @@ internal static ServiceMeshProfile DeserializeServiceMeshProfile(JsonElement ele { return null; } - ServiceMeshMode mode = default; - IstioServiceMesh istio = default; + ManagedClusterUpgradeSpec upgrade = default; + NodeImageSelection nodeImageSelection = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("mode"u8)) + if (property.NameEquals("upgrade"u8)) { - mode = new ServiceMeshMode(property.Value.GetString()); + upgrade = ManagedClusterUpgradeSpec.DeserializeManagedClusterUpgradeSpec(property.Value, options); continue; } - if (property.NameEquals("istio"u8)) + if (property.NameEquals("nodeImageSelection"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - istio = IstioServiceMesh.DeserializeIstioServiceMesh(property.Value, options); + nodeImageSelection = NodeImageSelection.DeserializeNodeImageSelection(property.Value, options); continue; } if (options.Format != "W") @@ -105,7 +105,7 @@ internal static ServiceMeshProfile DeserializeServiceMeshProfile(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new ServiceMeshProfile(mode, istio, serializedAdditionalRawData); + return new ManagedClusterUpdate(upgrade, nodeImageSelection, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -119,30 +119,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Upgrade), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" mode: "); + builder.Append(" upgrade: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" mode: "); - builder.AppendLine($"'{Mode.ToString()}'"); + if (Optional.IsDefined(Upgrade)) + { + builder.Append(" upgrade: "); + BicepSerializationHelpers.AppendChildObject(builder, Upgrade, options, 2, false, " upgrade: "); + } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Istio), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NodeImageSelection), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" istio: "); + builder.Append(" nodeImageSelection: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Istio)) + if (Optional.IsDefined(NodeImageSelection)) { - builder.Append(" istio: "); - BicepSerializationHelpers.AppendChildObject(builder, Istio, options, 2, false, " istio: "); + builder.Append(" nodeImageSelection: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeImageSelection, options, 2, false, " nodeImageSelection: "); } } @@ -150,9 +153,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -161,26 +164,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ServiceMeshProfile)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpdate)} does not support writing '{options.Format}' format."); } } - ServiceMeshProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ManagedClusterUpdate 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); - return DeserializeServiceMeshProfile(document.RootElement, options); + return DeserializeManagedClusterUpdate(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ServiceMeshProfile)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpdate)} 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/ManagedClusterServicePrincipalProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.cs similarity index 59% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.cs index d81dd3bd7904..8547b071cdb2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterServicePrincipalProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpdate.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Information about a service principal identity for the cluster to use for manipulating Azure APIs. - public partial class ManagedClusterServicePrincipalProfile + /// The update to be applied to the ManagedClusters. + public partial class ManagedClusterUpdate { /// /// Keeps track of any properties unknown to the library. @@ -45,37 +45,37 @@ public partial class ManagedClusterServicePrincipalProfile /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// The ID for the service principal. - /// is null. - public ManagedClusterServicePrincipalProfile(string clientId) + /// Initializes a new instance of . + /// The upgrade to apply to the ManagedClusters. + /// is null. + public ManagedClusterUpdate(ManagedClusterUpgradeSpec upgrade) { - Argument.AssertNotNull(clientId, nameof(clientId)); + Argument.AssertNotNull(upgrade, nameof(upgrade)); - ClientId = clientId; + Upgrade = upgrade; } - /// Initializes a new instance of . - /// The ID for the service principal. - /// The secret password associated with the service principal in plain text. + /// Initializes a new instance of . + /// The upgrade to apply to the ManagedClusters. + /// The node image upgrade to be applied to the target nodes in update run. /// Keeps track of any properties unknown to the library. - internal ManagedClusterServicePrincipalProfile(string clientId, string secret, IDictionary serializedAdditionalRawData) + internal ManagedClusterUpdate(ManagedClusterUpgradeSpec upgrade, NodeImageSelection nodeImageSelection, IDictionary serializedAdditionalRawData) { - ClientId = clientId; - Secret = secret; + Upgrade = upgrade; + NodeImageSelection = nodeImageSelection; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ManagedClusterServicePrincipalProfile() + /// Initializes a new instance of for deserialization. + internal ManagedClusterUpdate() { } - /// The ID for the service principal. - [WirePath("clientId")] - public string ClientId { get; set; } - /// The secret password associated with the service principal in plain text. - [WirePath("secret")] - public string Secret { get; set; } + /// The upgrade to apply to the ManagedClusters. + [WirePath("upgrade")] + public ManagedClusterUpgradeSpec Upgrade { get; set; } + /// The node image upgrade to be applied to the target nodes in update run. + [WirePath("nodeImageSelection")] + public NodeImageSelection NodeImageSelection { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.Serialization.cs similarity index 63% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.Serialization.cs index 1a03d5c018a5..66d28945db73 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPoolUpgradeProfileUpgradesItem : IUtf8JsonSerializable, IJsonModel + public partial class ManagedClusterUpgradeSpec : 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,22 +29,19 @@ void IJsonModel.Write(Utf8JsonWrit /// 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(ManagedClusterPoolUpgradeProfileUpgradesItem)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpgradeSpec)} does not support writing '{format}' format."); } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(UpgradeType.ToString()); if (Optional.IsDefined(KubernetesVersion)) { writer.WritePropertyName("kubernetesVersion"u8); writer.WriteStringValue(KubernetesVersion); } - if (Optional.IsDefined(IsPreview)) - { - writer.WritePropertyName("isPreview"u8); - writer.WriteBooleanValue(IsPreview.Value); - } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -62,19 +59,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterPoolUpgradeProfileUpgradesItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ManagedClusterUpgradeSpec 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(ManagedClusterPoolUpgradeProfileUpgradesItem)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpgradeSpec)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(document.RootElement, options); + return DeserializeManagedClusterUpgradeSpec(document.RootElement, options); } - internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(JsonElement element, ModelReaderWriterOptions options = null) + internal static ManagedClusterUpgradeSpec DeserializeManagedClusterUpgradeSpec(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -82,24 +79,20 @@ internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedC { return null; } + ManagedClusterUpgradeType type = default; string kubernetesVersion = default; - bool? isPreview = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kubernetesVersion"u8)) + if (property.NameEquals("type"u8)) { - kubernetesVersion = property.Value.GetString(); + type = new ManagedClusterUpgradeType(property.Value.GetString()); continue; } - if (property.NameEquals("isPreview"u8)) + if (property.NameEquals("kubernetesVersion"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - isPreview = property.Value.GetBoolean(); + kubernetesVersion = property.Value.GetString(); continue; } if (options.Format != "W") @@ -108,7 +101,7 @@ internal static ManagedClusterPoolUpgradeProfileUpgradesItem DeserializeManagedC } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPoolUpgradeProfileUpgradesItem(kubernetesVersion, isPreview, serializedAdditionalRawData); + return new ManagedClusterUpgradeSpec(type, kubernetesVersion, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -122,6 +115,18 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" type: "); + builder.AppendLine($"'{UpgradeType.ToString()}'"); + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); if (hasPropertyOverride) { @@ -145,29 +150,13 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsPreview), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" isPreview: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsPreview)) - { - builder.Append(" isPreview: "); - var boolValue = IsPreview.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - 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) { @@ -176,26 +165,26 @@ BinaryData IPersistableModel.Write case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterPoolUpgradeProfileUpgradesItem)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpgradeSpec)} does not support writing '{options.Format}' format."); } } - ManagedClusterPoolUpgradeProfileUpgradesItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ManagedClusterUpgradeSpec 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); - return DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(document.RootElement, options); + return DeserializeManagedClusterUpgradeSpec(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterPoolUpgradeProfileUpgradesItem)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedClusterUpgradeSpec)} 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/ManagedClusterPoolUpgradeProfileUpgradesItem.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.cs index fa913e10a318..5e17977c617f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfileUpgradesItem.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeSpec.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The ManagedClusterPoolUpgradeProfileUpgradesItem. - public partial class ManagedClusterPoolUpgradeProfileUpgradesItem + /// The upgrade to apply to a ManagedCluster. + public partial class ManagedClusterUpgradeSpec { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,34 @@ public partial class ManagedClusterPoolUpgradeProfileUpgradesItem /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ManagedClusterPoolUpgradeProfileUpgradesItem() + /// Initializes a new instance of . + /// ManagedClusterUpgradeType is the type of upgrade to be applied. + public ManagedClusterUpgradeSpec(ManagedClusterUpgradeType upgradeType) { + UpgradeType = upgradeType; } - /// Initializes a new instance of . - /// The Kubernetes version (major.minor.patch). - /// Whether the Kubernetes version is currently in preview. + /// Initializes a new instance of . + /// ManagedClusterUpgradeType is the type of upgrade to be applied. + /// The Kubernetes version to upgrade the member clusters to. /// Keeps track of any properties unknown to the library. - internal ManagedClusterPoolUpgradeProfileUpgradesItem(string kubernetesVersion, bool? isPreview, IDictionary serializedAdditionalRawData) + internal ManagedClusterUpgradeSpec(ManagedClusterUpgradeType upgradeType, string kubernetesVersion, IDictionary serializedAdditionalRawData) { + UpgradeType = upgradeType; KubernetesVersion = kubernetesVersion; - IsPreview = isPreview; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The Kubernetes version (major.minor.patch). + /// Initializes a new instance of for deserialization. + internal ManagedClusterUpgradeSpec() + { + } + + /// ManagedClusterUpgradeType is the type of upgrade to be applied. + [WirePath("type")] + public ManagedClusterUpgradeType UpgradeType { get; set; } + /// The Kubernetes version to upgrade the member clusters to. [WirePath("kubernetesVersion")] - public string KubernetesVersion { get; } - /// Whether the Kubernetes version is currently in preview. - [WirePath("isPreview")] - public bool? IsPreview { get; } + public string KubernetesVersion { get; set; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeType.cs new file mode 100644 index 000000000000..0fca044659df --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterUpgradeType.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 type of upgrade to perform when targeting ManagedClusters. + public readonly partial struct ManagedClusterUpgradeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedClusterUpgradeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FullValue = "Full"; + private const string NodeImageOnlyValue = "NodeImageOnly"; + private const string ControlPlaneOnlyValue = "ControlPlaneOnly"; + + /// Full upgrades the control plane and all agent pools of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. + public static ManagedClusterUpgradeType Full { get; } = new ManagedClusterUpgradeType(FullValue); + /// NodeImageOnly upgrades only the node images of the target ManagedClusters. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to NOT be set. + public static ManagedClusterUpgradeType NodeImageOnly { get; } = new ManagedClusterUpgradeType(NodeImageOnlyValue); + /// ControlPlaneOnly upgrades only targets the KubernetesVersion of the ManagedClusters and will not be applied to the AgentPool. Requires the ManagedClusterUpgradeSpec.KubernetesVersion property to be set. + public static ManagedClusterUpgradeType ControlPlaneOnly { get; } = new ManagedClusterUpgradeType(ControlPlaneOnlyValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedClusterUpgradeType left, ManagedClusterUpgradeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedClusterUpgradeType left, ManagedClusterUpgradeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagedClusterUpgradeType(string value) => new ManagedClusterUpgradeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedClusterUpgradeType other && Equals(other); + /// + public bool Equals(ManagedClusterUpgradeType 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/ManagedClusterVerticalPodAutoscaler.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs deleted file mode 100644 index dde1490559b2..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterVerticalPodAutoscaler.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -{ - /// VPA (Vertical Pod Autoscaler) settings for the workload auto-scaler profile. - internal partial class ManagedClusterVerticalPodAutoscaler - { - /// - /// 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 to enable VPA. Default value is false. - public ManagedClusterVerticalPodAutoscaler(bool isVpaEnabled) - { - IsVpaEnabled = isVpaEnabled; - } - - /// Initializes a new instance of . - /// Whether to enable VPA. Default value is false. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterVerticalPodAutoscaler(bool isVpaEnabled, IDictionary serializedAdditionalRawData) - { - IsVpaEnabled = isVpaEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterVerticalPodAutoscaler() - { - } - - /// Whether to enable VPA. Default value is false. - [WirePath("enabled")] - public bool IsVpaEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs deleted file mode 100644 index 02fce48e3ee4..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.Serialization.cs +++ /dev/null @@ -1,298 +0,0 @@ -// 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 ManagedClusterWindowsProfile : 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(ManagedClusterWindowsProfile)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("adminUsername"u8); - writer.WriteStringValue(AdminUsername); - if (Optional.IsDefined(AdminPassword)) - { - writer.WritePropertyName("adminPassword"u8); - writer.WriteStringValue(AdminPassword); - } - if (Optional.IsDefined(LicenseType)) - { - writer.WritePropertyName("licenseType"u8); - writer.WriteStringValue(LicenseType.Value.ToString()); - } - if (Optional.IsDefined(IsCsiProxyEnabled)) - { - writer.WritePropertyName("enableCSIProxy"u8); - writer.WriteBooleanValue(IsCsiProxyEnabled.Value); - } - if (Optional.IsDefined(GmsaProfile)) - { - writer.WritePropertyName("gmsaProfile"u8); - writer.WriteObjectValue(GmsaProfile, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterWindowsProfile 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(ManagedClusterWindowsProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterWindowsProfile(document.RootElement, options); - } - - internal static ManagedClusterWindowsProfile DeserializeManagedClusterWindowsProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string adminUsername = default; - string adminPassword = default; - WindowsVmLicenseType? licenseType = default; - bool? enableCsiProxy = default; - WindowsGmsaProfile gmsaProfile = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("adminUsername"u8)) - { - adminUsername = property.Value.GetString(); - continue; - } - if (property.NameEquals("adminPassword"u8)) - { - adminPassword = property.Value.GetString(); - continue; - } - if (property.NameEquals("licenseType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - licenseType = new WindowsVmLicenseType(property.Value.GetString()); - continue; - } - if (property.NameEquals("enableCSIProxy"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - enableCsiProxy = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("gmsaProfile"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - gmsaProfile = WindowsGmsaProfile.DeserializeWindowsGmsaProfile(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterWindowsProfile( - adminUsername, - adminPassword, - licenseType, - enableCsiProxy, - gmsaProfile, - 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(AdminUsername), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" adminUsername: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AdminUsername)) - { - builder.Append(" adminUsername: "); - if (AdminUsername.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AdminUsername}'''"); - } - else - { - builder.AppendLine($"'{AdminUsername}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdminPassword), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" adminPassword: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(AdminPassword)) - { - builder.Append(" adminPassword: "); - if (AdminPassword.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{AdminPassword}'''"); - } - else - { - builder.AppendLine($"'{AdminPassword}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LicenseType), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" licenseType: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(LicenseType)) - { - builder.Append(" licenseType: "); - builder.AppendLine($"'{LicenseType.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsCsiProxyEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enableCSIProxy: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsCsiProxyEnabled)) - { - builder.Append(" enableCSIProxy: "); - var boolValue = IsCsiProxyEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GmsaProfile), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" gmsaProfile: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(GmsaProfile)) - { - builder.Append(" gmsaProfile: "); - BicepSerializationHelpers.AppendChildObject(builder, GmsaProfile, options, 2, false, " gmsaProfile: "); - } - } - - 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(ManagedClusterWindowsProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterWindowsProfile 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); - return DeserializeManagedClusterWindowsProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterWindowsProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs deleted file mode 100644 index 0990ec9ec773..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWindowsProfile.cs +++ /dev/null @@ -1,96 +0,0 @@ -// 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 for Windows VMs in the managed cluster. - public partial class ManagedClusterWindowsProfile - { - /// - /// 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 . - /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. - /// is null. - public ManagedClusterWindowsProfile(string adminUsername) - { - Argument.AssertNotNull(adminUsername, nameof(adminUsername)); - - AdminUsername = adminUsername; - } - - /// Initializes a new instance of . - /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. - /// Specifies the password of the administrator account. <br><br> **Minimum-length:** 8 characters <br><br> **Max-length:** 123 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - /// The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. - /// For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). - /// The Windows gMSA Profile in the Managed Cluster. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterWindowsProfile(string adminUsername, string adminPassword, WindowsVmLicenseType? licenseType, bool? isCsiProxyEnabled, WindowsGmsaProfile gmsaProfile, IDictionary serializedAdditionalRawData) - { - AdminUsername = adminUsername; - AdminPassword = adminPassword; - LicenseType = licenseType; - IsCsiProxyEnabled = isCsiProxyEnabled; - GmsaProfile = gmsaProfile; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterWindowsProfile() - { - } - - /// Specifies the name of the administrator account. <br><br> **Restriction:** Cannot end in "." <br><br> **Disallowed values:** "administrator", "admin", "user", "user1", "test", "user2", "test1", "user3", "admin1", "1", "123", "a", "actuser", "adm", "admin2", "aspnet", "backup", "console", "david", "guest", "john", "owner", "root", "server", "sql", "support", "support_388945a0", "sys", "test2", "test3", "user4", "user5". <br><br> **Minimum-length:** 1 character <br><br> **Max-length:** 20 characters. - [WirePath("adminUsername")] - public string AdminUsername { get; set; } - /// Specifies the password of the administrator account. <br><br> **Minimum-length:** 8 characters <br><br> **Max-length:** 123 characters <br><br> **Complexity requirements:** 3 out of 4 conditions below need to be fulfilled <br> Has lower characters <br>Has upper characters <br> Has a digit <br> Has a special character (Regex match [\W_]) <br><br> **Disallowed values:** "abc@123", "P@$$w0rd", "P@ssw0rd", "P@ssword123", "Pa$$word", "pass@word1", "Password!", "Password1", "Password22", "iloveyou!". - [WirePath("adminPassword")] - public string AdminPassword { get; set; } - /// The license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. - [WirePath("licenseType")] - public WindowsVmLicenseType? LicenseType { get; set; } - /// For more details on CSI proxy, see the [CSI proxy GitHub repo](https://github.com/kubernetes-csi/csi-proxy). - [WirePath("enableCSIProxy")] - public bool? IsCsiProxyEnabled { get; set; } - /// The Windows gMSA Profile in the Managed Cluster. - [WirePath("gmsaProfile")] - public WindowsGmsaProfile GmsaProfile { 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 deleted file mode 100644 index b48d1243b825..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.Serialization.cs +++ /dev/null @@ -1,202 +0,0 @@ -// 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 ManagedClusterWorkloadAutoScalerProfile : 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(ManagedClusterWorkloadAutoScalerProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Keda)) - { - writer.WritePropertyName("keda"u8); - writer.WriteObjectValue(Keda, options); - } - if (Optional.IsDefined(VerticalPodAutoscaler)) - { - writer.WritePropertyName("verticalPodAutoscaler"u8); - writer.WriteObjectValue(VerticalPodAutoscaler, 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterWorkloadAutoScalerProfile 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(ManagedClusterWorkloadAutoScalerProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterWorkloadAutoScalerProfile(document.RootElement, options); - } - - internal static ManagedClusterWorkloadAutoScalerProfile DeserializeManagedClusterWorkloadAutoScalerProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - ManagedClusterWorkloadAutoScalerProfileKeda keda = default; - ManagedClusterVerticalPodAutoscaler verticalPodAutoscaler = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("keda"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - keda = ManagedClusterWorkloadAutoScalerProfileKeda.DeserializeManagedClusterWorkloadAutoScalerProfileKeda(property.Value, options); - continue; - } - if (property.NameEquals("verticalPodAutoscaler"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verticalPodAutoscaler = ManagedClusterVerticalPodAutoscaler.DeserializeManagedClusterVerticalPodAutoscaler(property.Value, options); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterWorkloadAutoScalerProfile(keda, verticalPodAutoscaler, 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("IsKedaEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" keda: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(Keda)) - { - builder.Append(" keda: "); - BicepSerializationHelpers.AppendChildObject(builder, Keda, options, 2, false, " keda: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("IsVpaEnabled", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" verticalPodAutoscaler: "); - builder.AppendLine("{"); - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(VerticalPodAutoscaler)) - { - builder.Append(" verticalPodAutoscaler: "); - BicepSerializationHelpers.AppendChildObject(builder, VerticalPodAutoscaler, options, 2, false, " verticalPodAutoscaler: "); - } - } - - 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(ManagedClusterWorkloadAutoScalerProfile)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterWorkloadAutoScalerProfile 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); - return DeserializeManagedClusterWorkloadAutoScalerProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterWorkloadAutoScalerProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs deleted file mode 100644 index 1b6315c05d7f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfile.cs +++ /dev/null @@ -1,90 +0,0 @@ -// 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 -{ - /// Workload Auto-scaler profile for the managed cluster. - public partial class ManagedClusterWorkloadAutoScalerProfile - { - /// - /// 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 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) - { - Keda = keda; - VerticalPodAutoscaler = verticalPodAutoscaler; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. - internal ManagedClusterWorkloadAutoScalerProfileKeda Keda { get; set; } - /// Whether to enable KEDA. - [WirePath("keda.enabled")] - public bool? IsKedaEnabled - { - get => Keda is null ? default(bool?) : Keda.IsKedaEnabled; - set - { - Keda = value.HasValue ? new ManagedClusterWorkloadAutoScalerProfileKeda(value.Value) : null; - } - } - - /// 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; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs deleted file mode 100644 index f854a303585e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.Serialization.cs +++ /dev/null @@ -1,157 +0,0 @@ -// 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 ManagedClusterWorkloadAutoScalerProfileKeda : 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(ManagedClusterWorkloadAutoScalerProfileKeda)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsKedaEnabled); - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - ManagedClusterWorkloadAutoScalerProfileKeda 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(ManagedClusterWorkloadAutoScalerProfileKeda)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterWorkloadAutoScalerProfileKeda(document.RootElement, options); - } - - internal static ManagedClusterWorkloadAutoScalerProfileKeda DeserializeManagedClusterWorkloadAutoScalerProfileKeda(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)) - { - enabled = property.Value.GetBoolean(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterWorkloadAutoScalerProfileKeda(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(IsKedaEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - builder.Append(" enabled: "); - var boolValue = IsKedaEnabled == 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(ManagedClusterWorkloadAutoScalerProfileKeda)} does not support writing '{options.Format}' format."); - } - } - - ManagedClusterWorkloadAutoScalerProfileKeda 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); - return DeserializeManagedClusterWorkloadAutoScalerProfileKeda(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(ManagedClusterWorkloadAutoScalerProfileKeda)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs deleted file mode 100644 index e2cecfd4c101..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterWorkloadAutoScalerProfileKeda.cs +++ /dev/null @@ -1,73 +0,0 @@ -// 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 -{ - /// KEDA (Kubernetes Event-driven Autoscaling) settings for the workload auto-scaler profile. - internal partial class ManagedClusterWorkloadAutoScalerProfileKeda - { - /// - /// 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 to enable KEDA. - public ManagedClusterWorkloadAutoScalerProfileKeda(bool isKedaEnabled) - { - IsKedaEnabled = isKedaEnabled; - } - - /// Initializes a new instance of . - /// Whether to enable KEDA. - /// Keeps track of any properties unknown to the library. - internal ManagedClusterWorkloadAutoScalerProfileKeda(bool isKedaEnabled, IDictionary serializedAdditionalRawData) - { - IsKedaEnabled = isKedaEnabled; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal ManagedClusterWorkloadAutoScalerProfileKeda() - { - } - - /// Whether to enable KEDA. - [WirePath("enabled")] - public bool IsKedaEnabled { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.Serialization.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.Serialization.cs index aa9ca89620cb..449c20c74c30 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterDelegatedIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.Serialization.cs @@ -8,17 +8,19 @@ 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.Models; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterDelegatedIdentity : IUtf8JsonSerializable, IJsonModel + internal partial class ManagedServiceIdentity : 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,31 +31,34 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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(ManagedClusterDelegatedIdentity)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ManagedServiceIdentity)} does not support writing '{format}' format."); } - if (Optional.IsDefined(ResourceId)) + if (options.Format != "W" && Optional.IsDefined(PrincipalId)) { - writer.WritePropertyName("resourceId"u8); - writer.WriteStringValue(ResourceId); + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); } - if (Optional.IsDefined(TenantId)) + if (options.Format != "W" && Optional.IsDefined(TenantId)) { writer.WritePropertyName("tenantId"u8); writer.WriteStringValue(TenantId.Value); } - if (Optional.IsDefined(ReferralResource)) + writer.WritePropertyName("type"u8); + writer.WriteStringValue(IdentityType.ToString()); + if (Optional.IsCollectionDefined(UserAssignedIdentities)) { - writer.WritePropertyName("referralResource"u8); - writer.WriteStringValue(ReferralResource); - } - if (Optional.IsDefined(Location)) - { - writer.WritePropertyName("location"u8); - writer.WriteStringValue(Location.Value); + writer.WritePropertyName("userAssignedIdentities"u8); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -72,19 +77,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterDelegatedIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ManagedServiceIdentity 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(ManagedClusterDelegatedIdentity)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ManagedServiceIdentity)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterDelegatedIdentity(document.RootElement, options); + return DeserializeManagedServiceIdentity(document.RootElement, options); } - internal static ManagedClusterDelegatedIdentity DeserializeManagedClusterDelegatedIdentity(JsonElement element, ModelReaderWriterOptions options = null) + internal static ManagedServiceIdentity DeserializeManagedServiceIdentity(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,21 +97,21 @@ internal static ManagedClusterDelegatedIdentity DeserializeManagedClusterDelegat { return null; } - ResourceIdentifier resourceId = default; + Guid? principalId = default; Guid? tenantId = default; - string referralResource = default; - AzureLocation? location = default; + ManagedServiceIdentityType type = default; + IDictionary userAssignedIdentities = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("resourceId"u8)) + if (property.NameEquals("principalId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - resourceId = new ResourceIdentifier(property.Value.GetString()); + principalId = property.Value.GetGuid(); continue; } if (property.NameEquals("tenantId"u8)) @@ -118,18 +123,23 @@ internal static ManagedClusterDelegatedIdentity DeserializeManagedClusterDelegat tenantId = property.Value.GetGuid(); continue; } - if (property.NameEquals("referralResource"u8)) + if (property.NameEquals("type"u8)) { - referralResource = property.Value.GetString(); + type = new ManagedServiceIdentityType(property.Value.GetString()); continue; } - if (property.NameEquals("location"u8)) + if (property.NameEquals("userAssignedIdentities"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - location = new AzureLocation(property.Value.GetString()); + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + userAssignedIdentities = dictionary; continue; } if (options.Format != "W") @@ -138,7 +148,7 @@ internal static ManagedClusterDelegatedIdentity DeserializeManagedClusterDelegat } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterDelegatedIdentity(resourceId, tenantId, referralResource, location, serializedAdditionalRawData); + return new ManagedServiceIdentity(principalId, tenantId, type, userAssignedIdentities ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -152,18 +162,18 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrincipalId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" resourceId: "); + builder.Append(" principalId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ResourceId)) + if (Optional.IsDefined(PrincipalId)) { - builder.Append(" resourceId: "); - builder.AppendLine($"'{ResourceId.ToString()}'"); + builder.Append(" principalId: "); + builder.AppendLine($"'{PrincipalId.Value.ToString()}'"); } } @@ -182,41 +192,39 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReferralResource), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IdentityType), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" referralResource: "); + builder.Append(" type: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ReferralResource)) - { - builder.Append(" referralResource: "); - if (ReferralResource.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{ReferralResource}'''"); - } - else - { - builder.AppendLine($"'{ReferralResource}'"); - } - } + builder.Append(" type: "); + builder.AppendLine($"'{IdentityType.ToString()}'"); } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserAssignedIdentities), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" location: "); + builder.Append(" userAssignedIdentities: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Location)) + if (Optional.IsCollectionDefined(UserAssignedIdentities)) { - builder.Append(" location: "); - builder.AppendLine($"'{Location.Value.ToString()}'"); + if (UserAssignedIdentities.Any()) + { + builder.Append(" userAssignedIdentities: "); + builder.AppendLine("{"); + foreach (var item in UserAssignedIdentities) + { + builder.Append($" '{item.Key}': "); + BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 4, false, " userAssignedIdentities: "); + } + builder.AppendLine(" }"); + } } } @@ -224,9 +232,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -235,26 +243,26 @@ BinaryData IPersistableModel.Write(ModelReaderW case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterDelegatedIdentity)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedServiceIdentity)} does not support writing '{options.Format}' format."); } } - ManagedClusterDelegatedIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ManagedServiceIdentity 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); - return DeserializeManagedClusterDelegatedIdentity(document.RootElement, options); + return DeserializeManagedServiceIdentity(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterDelegatedIdentity)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ManagedServiceIdentity)} 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/ManagedServiceIdentity.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.cs new file mode 100644 index 000000000000..ece3d34eb065 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentity.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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Managed service identity (system assigned and/or user assigned identities). + internal partial class ManagedServiceIdentity + { + /// + /// 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 . + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + public ManagedServiceIdentity(ManagedServiceIdentityType identityType) + { + IdentityType = identityType; + UserAssignedIdentities = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + /// The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + /// Keeps track of any properties unknown to the library. + internal ManagedServiceIdentity(Guid? principalId, Guid? tenantId, ManagedServiceIdentityType identityType, IDictionary userAssignedIdentities, IDictionary serializedAdditionalRawData) + { + PrincipalId = principalId; + TenantId = tenantId; + IdentityType = identityType; + UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedServiceIdentity() + { + } + + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + [WirePath("principalId")] + public Guid? PrincipalId { get; } + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + [WirePath("tenantId")] + public Guid? TenantId { get; } + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + [WirePath("type")] + public ManagedServiceIdentityType IdentityType { get; set; } + /// The set of user assigned identities associated with the resource. The userAssignedIdentities dictionary keys will be ARM resource ids in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ManagedIdentity/userAssignedIdentities/{identityName}. The dictionary values can be empty objects ({}) in requests. + [WirePath("userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..775e4d9d79b2 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedServiceIdentityType.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 +{ + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + public readonly partial struct ManagedServiceIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedServiceIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string SystemAssignedValue = "SystemAssigned"; + private const string UserAssignedValue = "UserAssigned"; + private const string SystemAssignedUserAssignedValue = "SystemAssigned, UserAssigned"; + + /// None. + public static ManagedServiceIdentityType None { get; } = new ManagedServiceIdentityType(NoneValue); + /// SystemAssigned. + public static ManagedServiceIdentityType SystemAssigned { get; } = new ManagedServiceIdentityType(SystemAssignedValue); + /// UserAssigned. + public static ManagedServiceIdentityType UserAssigned { get; } = new ManagedServiceIdentityType(UserAssignedValue); + /// SystemAssigned, UserAssigned. + public static ManagedServiceIdentityType SystemAssignedUserAssigned { get; } = new ManagedServiceIdentityType(SystemAssignedUserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagedServiceIdentityType(string value) => new ManagedServiceIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedServiceIdentityType other && Equals(other); + /// + public bool Equals(ManagedServiceIdentityType 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/ManagedClusterPodIdentity.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.Serialization.cs similarity index 52% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.Serialization.cs index d2b34f2bd71e..d37df896590a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPodIdentity.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPodIdentity : IUtf8JsonSerializable, IJsonModel + public partial class MemberUpdateStatus : 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,32 +29,36 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea /// 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(ManagedClusterPodIdentity)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(MemberUpdateStatus)} does not support writing '{format}' format."); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("namespace"u8); - writer.WriteStringValue(Namespace); - if (Optional.IsDefined(BindingSelector)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("bindingSelector"u8); - writer.WriteStringValue(BindingSelector); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } - writer.WritePropertyName("identity"u8); - writer.WriteObjectValue(Identity, options); - if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + if (options.Format != "W" && Optional.IsDefined(Name)) { - writer.WritePropertyName("provisioningState"u8); - writer.WriteStringValue(ProvisioningState.Value.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); } - if (options.Format != "W" && Optional.IsDefined(ProvisioningInfo)) + if (options.Format != "W" && Optional.IsDefined(ClusterResourceId)) { - writer.WritePropertyName("provisioningInfo"u8); - writer.WriteObjectValue(ProvisioningInfo, options); + writer.WritePropertyName("clusterResourceId"u8); + writer.WriteStringValue(ClusterResourceId); + } + if (options.Format != "W" && Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + if (options.Format != "W" && Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -73,19 +77,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterPodIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + MemberUpdateStatus 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(ManagedClusterPodIdentity)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(MemberUpdateStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPodIdentity(document.RootElement, options); + return DeserializeMemberUpdateStatus(document.RootElement, options); } - internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(JsonElement element, ModelReaderWriterOptions options = null) + internal static MemberUpdateStatus DeserializeMemberUpdateStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,52 +97,46 @@ internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(J { return null; } + UpdateStatus status = default; string name = default; - string @namespace = default; - string bindingSelector = default; - ContainerServiceUserAssignedIdentity identity = default; - ManagedClusterPodIdentityProvisioningState? provisioningState = default; - ManagedClusterPodIdentityProvisioningInfo provisioningInfo = default; + ResourceIdentifier clusterResourceId = default; + string operationId = default; + string message = 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("namespace"u8)) + if (property.NameEquals("status"u8)) { - @namespace = property.Value.GetString(); - continue; - } - if (property.NameEquals("bindingSelector"u8)) - { - bindingSelector = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = UpdateStatus.DeserializeUpdateStatus(property.Value, options); continue; } - if (property.NameEquals("identity"u8)) + if (property.NameEquals("name"u8)) { - identity = ContainerServiceUserAssignedIdentity.DeserializeContainerServiceUserAssignedIdentity(property.Value, options); + name = property.Value.GetString(); continue; } - if (property.NameEquals("provisioningState"u8)) + if (property.NameEquals("clusterResourceId"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - provisioningState = new ManagedClusterPodIdentityProvisioningState(property.Value.GetString()); + clusterResourceId = new ResourceIdentifier(property.Value.GetString()); continue; } - if (property.NameEquals("provisioningInfo"u8)) + if (property.NameEquals("operationId"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - provisioningInfo = ManagedClusterPodIdentityProvisioningInfo.DeserializeManagedClusterPodIdentityProvisioningInfo(property.Value, options); + operationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); continue; } if (options.Format != "W") @@ -147,13 +145,12 @@ internal static ManagedClusterPodIdentity DeserializeManagedClusterPodIdentity(J } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPodIdentity( + return new MemberUpdateStatus( + status, name, - @namespace, - bindingSelector, - identity, - provisioningState, - provisioningInfo, + clusterResourceId, + operationId, + message, serializedAdditionalRawData); } @@ -168,6 +165,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); if (hasPropertyOverride) { @@ -191,99 +203,64 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Namespace), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClusterResourceId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" namespace: "); + builder.Append(" clusterResourceId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Namespace)) + if (Optional.IsDefined(ClusterResourceId)) { - builder.Append(" namespace: "); - if (Namespace.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Namespace}'''"); - } - else - { - builder.AppendLine($"'{Namespace}'"); - } + builder.Append(" clusterResourceId: "); + builder.AppendLine($"'{ClusterResourceId.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BindingSelector), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OperationId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" bindingSelector: "); + builder.Append(" operationId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(BindingSelector)) + if (Optional.IsDefined(OperationId)) { - builder.Append(" bindingSelector: "); - if (BindingSelector.Contains(Environment.NewLine)) + builder.Append(" operationId: "); + if (OperationId.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{BindingSelector}'''"); + builder.AppendLine($"{OperationId}'''"); } else { - builder.AppendLine($"'{BindingSelector}'"); + builder.AppendLine($"'{OperationId}'"); } } } - 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: "); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" provisioningState: "); + builder.Append(" message: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ProvisioningState)) + if (Optional.IsDefined(Message)) { - builder.Append(" provisioningState: "); - builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ErrorDetail", out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" provisioningInfo: "); - builder.AppendLine("{"); - builder.AppendLine(" error: {"); - builder.Append(" error: "); - builder.AppendLine(propertyOverride); - builder.AppendLine(" }"); - builder.AppendLine(" }"); - } - else - { - if (Optional.IsDefined(ProvisioningInfo)) - { - builder.Append(" provisioningInfo: "); - BicepSerializationHelpers.AppendChildObject(builder, ProvisioningInfo, options, 2, false, " provisioningInfo: "); + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } } } @@ -291,9 +268,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -302,26 +279,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterO case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentity)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(MemberUpdateStatus)} does not support writing '{options.Format}' format."); } } - ManagedClusterPodIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + MemberUpdateStatus 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); - return DeserializeManagedClusterPodIdentity(document.RootElement, options); + return DeserializeMemberUpdateStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterPodIdentity)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(MemberUpdateStatus)} 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/ManagedClusterSku.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.cs similarity index 52% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.cs index 314c8069ca7f..3123c63b262b 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterSku.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MemberUpdateStatus.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models { - /// The SKU of a Managed Cluster. - public partial class ManagedClusterSku + /// The status of a member update operation. + public partial class MemberUpdateStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +46,42 @@ public partial class ManagedClusterSku /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ManagedClusterSku() + /// Initializes a new instance of . + internal MemberUpdateStatus() { } - /// Initializes a new instance of . - /// The name of a managed cluster SKU. - /// If not specified, the default is 'Free'. See [AKS Pricing Tier](https://learn.microsoft.com/azure/aks/free-standard-pricing-tiers) for more details. + /// Initializes a new instance of . + /// The status of the MemberUpdate operation. + /// The name of the FleetMember. + /// The Azure resource id of the target Kubernetes cluster. + /// The operation resource id of the latest attempt to perform the operation. + /// The status message after processing the member update operation. /// Keeps track of any properties unknown to the library. - internal ManagedClusterSku(ManagedClusterSkuName? name, ManagedClusterSkuTier? tier, IDictionary serializedAdditionalRawData) + internal MemberUpdateStatus(UpdateStatus status, string name, ResourceIdentifier clusterResourceId, string operationId, string message, IDictionary serializedAdditionalRawData) { + Status = status; Name = name; - Tier = tier; + ClusterResourceId = clusterResourceId; + OperationId = operationId; + Message = message; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The name of a managed cluster SKU. + /// The status of the MemberUpdate operation. + [WirePath("status")] + public UpdateStatus Status { get; } + /// The name of the FleetMember. [WirePath("name")] - public ManagedClusterSkuName? Name { get; set; } - /// If not specified, the default is 'Free'. See [AKS Pricing Tier](https://learn.microsoft.com/azure/aks/free-standard-pricing-tiers) for more details. - [WirePath("tier")] - public ManagedClusterSkuTier? Tier { get; set; } + public string Name { get; } + /// The Azure resource id of the target Kubernetes cluster. + [WirePath("clusterResourceId")] + public ResourceIdentifier ClusterResourceId { get; } + /// The operation resource id of the latest attempt to perform the operation. + [WirePath("operationId")] + public string OperationId { get; } + /// The status message after processing the member update operation. + [WirePath("message")] + public string Message { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.Serialization.cs deleted file mode 100644 index 63e992700ab7..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.Serialization.cs +++ /dev/null @@ -1,280 +0,0 @@ -// 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 MeshRevision : 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(MeshRevision)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(Revision)) - { - writer.WritePropertyName("revision"u8); - writer.WriteStringValue(Revision); - } - if (Optional.IsCollectionDefined(Upgrades)) - { - writer.WritePropertyName("upgrades"u8); - writer.WriteStartArray(); - foreach (var item in Upgrades) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(CompatibleWith)) - { - writer.WritePropertyName("compatibleWith"u8); - writer.WriteStartArray(); - foreach (var item in CompatibleWith) - { - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - MeshRevision 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(MeshRevision)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshRevision(document.RootElement, options); - } - - internal static MeshRevision DeserializeMeshRevision(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string revision = default; - IList upgrades = default; - IList compatibleWith = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("revision"u8)) - { - revision = property.Value.GetString(); - continue; - } - if (property.NameEquals("upgrades"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - upgrades = array; - continue; - } - if (property.NameEquals("compatibleWith"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(CompatibleVersions.DeserializeCompatibleVersions(item, options)); - } - compatibleWith = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MeshRevision(revision, upgrades ?? new ChangeTrackingList(), compatibleWith ?? 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(Revision), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" revision: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Revision)) - { - builder.Append(" revision: "); - if (Revision.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Revision}'''"); - } - else - { - builder.AppendLine($"'{Revision}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Upgrades), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgrades: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Upgrades)) - { - if (Upgrades.Any()) - { - builder.Append(" upgrades: "); - builder.AppendLine("["); - foreach (var item in Upgrades) - { - 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(CompatibleWith), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" compatibleWith: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(CompatibleWith)) - { - if (CompatibleWith.Any()) - { - builder.Append(" compatibleWith: "); - builder.AppendLine("["); - foreach (var item in CompatibleWith) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " compatibleWith: "); - } - 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(MeshRevision)} does not support writing '{options.Format}' format."); - } - } - - MeshRevision 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); - return DeserializeMeshRevision(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MeshRevision)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.cs deleted file mode 100644 index b1f9cdfea153..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevision.cs +++ /dev/null @@ -1,78 +0,0 @@ -// 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 information on upgrades and compatibility for given major.minor mesh release. - public partial class MeshRevision - { - /// - /// 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 protected IDictionary _serializedAdditionalRawData; - - /// Initializes a new instance of . - public MeshRevision() - { - Upgrades = new ChangeTrackingList(); - CompatibleWith = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// The revision of the mesh release. - /// List of revisions available for upgrade of a specific mesh revision. - /// List of items this revision of service mesh is compatible with, and their associated versions. - /// Keeps track of any properties unknown to the library. - internal MeshRevision(string revision, IList upgrades, IList compatibleWith, IDictionary serializedAdditionalRawData) - { - Revision = revision; - Upgrades = upgrades; - CompatibleWith = compatibleWith; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// The revision of the mesh release. - [WirePath("revision")] - public string Revision { get; set; } - /// List of revisions available for upgrade of a specific mesh revision. - [WirePath("upgrades")] - public IList Upgrades { get; } - /// List of items this revision of service mesh is compatible with, and their associated versions. - [WirePath("compatibleWith")] - public IList CompatibleWith { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.cs deleted file mode 100644 index 09ec75f4ad1a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileList.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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 of MeshRevisionsProfiles. - internal partial class MeshRevisionProfileList - { - /// - /// 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 MeshRevisionProfileList() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Array of service mesh add-on revision profiles for all supported mesh modes. - /// The URL to get the next set of mesh revision profile. - /// Keeps track of any properties unknown to the library. - internal MeshRevisionProfileList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Array of service mesh add-on revision profiles for all supported mesh modes. - public IReadOnlyList Value { get; } - /// The URL to get the next set of mesh revision profile. - public string NextLink { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.cs deleted file mode 100644 index c4f93a92bf4b..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.cs +++ /dev/null @@ -1,67 +0,0 @@ -// 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 -{ - /// Mesh revision profile properties for a mesh. - internal partial class MeshRevisionProfileProperties - { - /// - /// 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 MeshRevisionProfileProperties() - { - MeshRevisions = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// - /// Keeps track of any properties unknown to the library. - internal MeshRevisionProfileProperties(IList meshRevisions, IDictionary serializedAdditionalRawData) - { - MeshRevisions = meshRevisions; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Gets the mesh revisions. - [WirePath("meshRevisions")] - public IList MeshRevisions { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.Serialization.cs deleted file mode 100644 index 2e7c147abba1..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.Serialization.cs +++ /dev/null @@ -1,241 +0,0 @@ -// 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 MeshUpgradeProfileProperties : 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(MeshUpgradeProfileProperties)} does not support writing '{format}' format."); - } - - base.JsonModelWriteCore(writer, options); - } - - MeshUpgradeProfileProperties 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(MeshUpgradeProfileProperties)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshUpgradeProfileProperties(document.RootElement, options); - } - - internal static MeshUpgradeProfileProperties DeserializeMeshUpgradeProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string revision = default; - IList upgrades = default; - IList compatibleWith = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("revision"u8)) - { - revision = property.Value.GetString(); - continue; - } - if (property.NameEquals("upgrades"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(item.GetString()); - } - upgrades = array; - continue; - } - if (property.NameEquals("compatibleWith"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(CompatibleVersions.DeserializeCompatibleVersions(item, options)); - } - compatibleWith = array; - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new MeshUpgradeProfileProperties(revision, upgrades ?? new ChangeTrackingList(), compatibleWith ?? 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(Revision), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" revision: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Revision)) - { - builder.Append(" revision: "); - if (Revision.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Revision}'''"); - } - else - { - builder.AppendLine($"'{Revision}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Upgrades), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" upgrades: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(Upgrades)) - { - if (Upgrades.Any()) - { - builder.Append(" upgrades: "); - builder.AppendLine("["); - foreach (var item in Upgrades) - { - 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(CompatibleWith), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" compatibleWith: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(CompatibleWith)) - { - if (CompatibleWith.Any()) - { - builder.Append(" compatibleWith: "); - builder.AppendLine("["); - foreach (var item in CompatibleWith) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " compatibleWith: "); - } - 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(MeshUpgradeProfileProperties)} does not support writing '{options.Format}' format."); - } - } - - MeshUpgradeProfileProperties 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); - return DeserializeMeshUpgradeProfileProperties(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(MeshUpgradeProfileProperties)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.cs deleted file mode 100644 index ad3f86c995ea..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshUpgradeProfileProperties.cs +++ /dev/null @@ -1,30 +0,0 @@ -// 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 -{ - /// Mesh upgrade profile properties for a major.minor release. - public partial class MeshUpgradeProfileProperties : MeshRevision - { - /// Initializes a new instance of . - public MeshUpgradeProfileProperties() - { - } - - /// Initializes a new instance of . - /// The revision of the mesh release. - /// List of revisions available for upgrade of a specific mesh revision. - /// List of items this revision of service mesh is compatible with, and their associated versions. - /// Keeps track of any properties unknown to the library. - internal MeshUpgradeProfileProperties(string revision, IList upgrades, IList compatibleWith, IDictionary serializedAdditionalRawData) : base(revision, upgrades, compatibleWith, serializedAdditionalRawData) - { - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkDataplane.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkDataplane.cs deleted file mode 100644 index d92f8afd42dc..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NetworkDataplane.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Network dataplane used in the Kubernetes cluster. - public readonly partial struct NetworkDataplane : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public NetworkDataplane(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AzureValue = "azure"; - private const string CiliumValue = "cilium"; - - /// Use Azure network dataplane. - public static NetworkDataplane Azure { get; } = new NetworkDataplane(AzureValue); - /// Use Cilium network dataplane. See [Azure CNI Powered by Cilium](https://learn.microsoft.com/azure/aks/azure-cni-powered-by-cilium) for more information. - public static NetworkDataplane Cilium { get; } = new NetworkDataplane(CiliumValue); - /// Determines if two values are the same. - public static bool operator ==(NetworkDataplane left, NetworkDataplane right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(NetworkDataplane left, NetworkDataplane right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator NetworkDataplane(string value) => new NetworkDataplane(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is NetworkDataplane other && Equals(other); - /// - public bool Equals(NetworkDataplane 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/CompatibleVersions.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.Serialization.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/CompatibleVersions.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.Serialization.cs index 88b8cc406c41..86c367538ae9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/CompatibleVersions.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class CompatibleVersions : IUtf8JsonSerializable, IJsonModel + public partial class NodeImageSelection : 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); @@ -30,24 +30,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit /// 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(CompatibleVersions)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelection)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Name)) + writer.WritePropertyName("type"u8); + writer.WriteStringValue(SelectionType.ToString()); + if (Optional.IsCollectionDefined(CustomNodeImageVersions)) { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsCollectionDefined(Versions)) - { - writer.WritePropertyName("versions"u8); + writer.WritePropertyName("customNodeImageVersions"u8); writer.WriteStartArray(); - foreach (var item in Versions) + foreach (var item in CustomNodeImageVersions) { - writer.WriteStringValue(item); + writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } @@ -68,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CompatibleVersions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NodeImageSelection 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(CompatibleVersions)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelection)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCompatibleVersions(document.RootElement, options); + return DeserializeNodeImageSelection(document.RootElement, options); } - internal static CompatibleVersions DeserializeCompatibleVersions(JsonElement element, ModelReaderWriterOptions options = null) + internal static NodeImageSelection DeserializeNodeImageSelection(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,29 +85,29 @@ internal static CompatibleVersions DeserializeCompatibleVersions(JsonElement ele { return null; } - string name = default; - IList versions = default; + NodeImageSelectionType type = default; + IList customNodeImageVersions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name"u8)) + if (property.NameEquals("type"u8)) { - name = property.Value.GetString(); + type = new NodeImageSelectionType(property.Value.GetString()); continue; } - if (property.NameEquals("versions"u8)) + if (property.NameEquals("customNodeImageVersions"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(item.GetString()); + array.Add(NodeImageVersion.DeserializeNodeImageVersion(item, options)); } - versions = array; + customNodeImageVersions = array; continue; } if (options.Format != "W") @@ -119,7 +116,7 @@ internal static CompatibleVersions DeserializeCompatibleVersions(JsonElement ele } } serializedAdditionalRawData = rawDataDictionary; - return new CompatibleVersions(name, versions ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new NodeImageSelection(type, customNodeImageVersions ?? new ChangeTrackingList(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -133,59 +130,35 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SelectionType), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" name: "); + builder.Append(" type: "); 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}'"); - } - } + builder.Append(" type: "); + builder.AppendLine($"'{SelectionType.ToString()}'"); } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Versions), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomNodeImageVersions), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" versions: "); + builder.Append(" customNodeImageVersions: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(Versions)) + if (Optional.IsCollectionDefined(CustomNodeImageVersions)) { - if (Versions.Any()) + if (CustomNodeImageVersions.Any()) { - builder.Append(" versions: "); + builder.Append(" customNodeImageVersions: "); builder.AppendLine("["); - foreach (var item in Versions) + foreach (var item in CustomNodeImageVersions) { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " customNodeImageVersions: "); } builder.AppendLine(" ]"); } @@ -196,9 +169,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -207,26 +180,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(CompatibleVersions)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelection)} does not support writing '{options.Format}' format."); } } - CompatibleVersions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NodeImageSelection 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); - return DeserializeCompatibleVersions(document.RootElement, options); + return DeserializeNodeImageSelection(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CompatibleVersions)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelection)} 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/NodeImageSelection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.cs new file mode 100644 index 000000000000..88821149bc71 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelection.cs @@ -0,0 +1,79 @@ +// 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 node image upgrade to be applied to the target nodes in update run. + public partial class NodeImageSelection + { + /// + /// 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 node image upgrade type. + public NodeImageSelection(NodeImageSelectionType selectionType) + { + SelectionType = selectionType; + CustomNodeImageVersions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The node image upgrade type. + /// Custom node image versions to upgrade the nodes to. This field is required if node image selection type is Custom. Otherwise, it must be empty. For each node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a matching image version in this field, they are not upgraded. + /// Keeps track of any properties unknown to the library. + internal NodeImageSelection(NodeImageSelectionType selectionType, IList customNodeImageVersions, IDictionary serializedAdditionalRawData) + { + SelectionType = selectionType; + CustomNodeImageVersions = customNodeImageVersions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal NodeImageSelection() + { + } + + /// The node image upgrade type. + [WirePath("type")] + public NodeImageSelectionType SelectionType { get; set; } + /// Custom node image versions to upgrade the nodes to. This field is required if node image selection type is Custom. Otherwise, it must be empty. For each node image family (e.g., 'AKSUbuntu-1804gen2containerd'), this field can contain at most one version (e.g., only one of 'AKSUbuntu-1804gen2containerd-2023.01.12' or 'AKSUbuntu-1804gen2containerd-2023.02.12', not both). If the nodes belong to a family without a matching image version in this field, they are not upgraded. + [WirePath("customNodeImageVersions")] + public IList CustomNodeImageVersions { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs index fbb8dbd9deef..27ea7092d8f5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/MeshRevisionProfileProperties.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class MeshRevisionProfileProperties : IUtf8JsonSerializable, IJsonModel + internal partial class NodeImageSelectionStatus : 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); @@ -30,17 +30,17 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mode /// 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(MeshRevisionProfileProperties)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelectionStatus)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(MeshRevisions)) + if (options.Format != "W" && Optional.IsCollectionDefined(SelectedNodeImageVersions)) { - writer.WritePropertyName("meshRevisions"u8); + writer.WritePropertyName("selectedNodeImageVersions"u8); writer.WriteStartArray(); - foreach (var item in MeshRevisions) + foreach (var item in SelectedNodeImageVersions) { writer.WriteObjectValue(item, options); } @@ -63,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - MeshRevisionProfileProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NodeImageSelectionStatus 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(MeshRevisionProfileProperties)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelectionStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeMeshRevisionProfileProperties(document.RootElement, options); + return DeserializeNodeImageSelectionStatus(document.RootElement, options); } - internal static MeshRevisionProfileProperties DeserializeMeshRevisionProfileProperties(JsonElement element, ModelReaderWriterOptions options = null) + internal static NodeImageSelectionStatus DeserializeNodeImageSelectionStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,23 +83,23 @@ internal static MeshRevisionProfileProperties DeserializeMeshRevisionProfileProp { return null; } - IList meshRevisions = default; + IReadOnlyList selectedNodeImageVersions = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("meshRevisions"u8)) + if (property.NameEquals("selectedNodeImageVersions"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(MeshRevision.DeserializeMeshRevision(item, options)); + array.Add(NodeImageVersion.DeserializeNodeImageVersion(item, options)); } - meshRevisions = array; + selectedNodeImageVersions = array; continue; } if (options.Format != "W") @@ -108,7 +108,7 @@ internal static MeshRevisionProfileProperties DeserializeMeshRevisionProfileProp } } serializedAdditionalRawData = rawDataDictionary; - return new MeshRevisionProfileProperties(meshRevisions ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new NodeImageSelectionStatus(selectedNodeImageVersions ?? new ChangeTrackingList(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -122,23 +122,23 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MeshRevisions), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SelectedNodeImageVersions), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" meshRevisions: "); + builder.Append(" selectedNodeImageVersions: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(MeshRevisions)) + if (Optional.IsCollectionDefined(SelectedNodeImageVersions)) { - if (MeshRevisions.Any()) + if (SelectedNodeImageVersions.Any()) { - builder.Append(" meshRevisions: "); + builder.Append(" selectedNodeImageVersions: "); builder.AppendLine("["); - foreach (var item in MeshRevisions) + foreach (var item in SelectedNodeImageVersions) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " meshRevisions: "); + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " selectedNodeImageVersions: "); } builder.AppendLine(" ]"); } @@ -149,9 +149,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -160,26 +160,26 @@ BinaryData IPersistableModel.Write(ModelReaderWri case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(MeshRevisionProfileProperties)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelectionStatus)} does not support writing '{options.Format}' format."); } } - MeshRevisionProfileProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NodeImageSelectionStatus 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); - return DeserializeMeshRevisionProfileProperties(document.RootElement, options); + return DeserializeNodeImageSelectionStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(MeshRevisionProfileProperties)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageSelectionStatus)} 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/KubernetesVersionListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.cs similarity index 65% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.cs index 316a24d46b4e..f0d422e8c1d0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/KubernetesVersionListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Hold values properties, which is array of KubernetesVersion. - public partial class KubernetesVersionListResult + /// The node image upgrade specs for the update run. + internal partial class NodeImageSelectionStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,23 +45,23 @@ public partial class KubernetesVersionListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal KubernetesVersionListResult() + /// Initializes a new instance of . + internal NodeImageSelectionStatus() { - Values = new ChangeTrackingList(); + SelectedNodeImageVersions = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Array of AKS supported Kubernetes versions. + /// Initializes a new instance of . + /// The image versions to upgrade the nodes to. /// Keeps track of any properties unknown to the library. - internal KubernetesVersionListResult(IReadOnlyList values, IDictionary serializedAdditionalRawData) + internal NodeImageSelectionStatus(IReadOnlyList selectedNodeImageVersions, IDictionary serializedAdditionalRawData) { - Values = values; + SelectedNodeImageVersions = selectedNodeImageVersions; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Array of AKS supported Kubernetes versions. - [WirePath("values")] - public IReadOnlyList Values { get; } + /// The image versions to upgrade the nodes to. + [WirePath("selectedNodeImageVersions")] + public IReadOnlyList SelectedNodeImageVersions { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionType.cs new file mode 100644 index 000000000000..a37822259919 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageSelectionType.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 node image upgrade type. + public readonly partial struct NodeImageSelectionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public NodeImageSelectionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LatestValue = "Latest"; + private const string ConsistentValue = "Consistent"; + private const string CustomValue = "Custom"; + + /// Use the latest image version when upgrading nodes. Clusters may use different image versions (e.g., 'AKSUbuntu-1804gen2containerd-2021.10.12' and 'AKSUbuntu-1804gen2containerd-2021.10.19') because, for example, the latest available version is different in different regions. + public static NodeImageSelectionType Latest { get; } = new NodeImageSelectionType(LatestValue); + /// The image versions to upgrade nodes to are selected as described below: for each node pool in managed clusters affected by the update run, the system selects the latest image version such that it is available across all other node pools (in all other clusters) of the same image type. As a result, all node pools of the same image type will be upgraded to the same image version. For example, if the latest image version for image type 'AKSUbuntu-1804gen2containerd' is 'AKSUbuntu-1804gen2containerd-2021.10.12' for a node pool in cluster A in region X, and is 'AKSUbuntu-1804gen2containerd-2021.10.17' for a node pool in cluster B in region Y, the system will upgrade both node pools to image version 'AKSUbuntu-1804gen2containerd-2021.10.12'. + public static NodeImageSelectionType Consistent { get; } = new NodeImageSelectionType(ConsistentValue); + /// Upgrade the nodes to the custom image versions. When set, update run will use node image versions provided in customNodeImageVersions to upgrade the nodes. If set, customNodeImageVersions must not be empty. + public static NodeImageSelectionType Custom { get; } = new NodeImageSelectionType(CustomValue); + /// Determines if two values are the same. + public static bool operator ==(NodeImageSelectionType left, NodeImageSelectionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(NodeImageSelectionType left, NodeImageSelectionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator NodeImageSelectionType(string value) => new NodeImageSelectionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is NodeImageSelectionType other && Equals(other); + /// + public bool Equals(NodeImageSelectionType 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/ContainerServiceSshPublicKey.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs similarity index 62% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs index e91ea23f1c5d..2c72960951c5 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceSshPublicKey : IUtf8JsonSerializable, IJsonModel + public partial class NodeImageVersion : 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,14 +29,17 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model /// 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(ContainerServiceSshPublicKey)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support writing '{format}' format."); } - writer.WritePropertyName("keyData"u8); - writer.WriteStringValue(KeyData); + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -54,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceSshPublicKey IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + NodeImageVersion 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(ContainerServiceSshPublicKey)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceSshPublicKey(document.RootElement, options); + return DeserializeNodeImageVersion(document.RootElement, options); } - internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPublicKey(JsonElement element, ModelReaderWriterOptions options = null) + internal static NodeImageVersion DeserializeNodeImageVersion(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -74,14 +77,14 @@ internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPubli { return null; } - string keyData = default; + string version = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("keyData"u8)) + if (property.NameEquals("version"u8)) { - keyData = property.Value.GetString(); + version = property.Value.GetString(); continue; } if (options.Format != "W") @@ -90,7 +93,7 @@ internal static ContainerServiceSshPublicKey DeserializeContainerServiceSshPubli } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceSshPublicKey(keyData, serializedAdditionalRawData); + return new NodeImageVersion(version, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -104,25 +107,25 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyData), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" keyData: "); + builder.Append(" version: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(KeyData)) + if (Optional.IsDefined(Version)) { - builder.Append(" keyData: "); - if (KeyData.Contains(Environment.NewLine)) + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{KeyData}'''"); + builder.AppendLine($"{Version}'''"); } else { - builder.AppendLine($"'{KeyData}'"); + builder.AppendLine($"'{Version}'"); } } } @@ -131,9 +134,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -142,26 +145,26 @@ BinaryData IPersistableModel.Write(ModelReaderWrit case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceSshPublicKey)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageVersion)} does not support writing '{options.Format}' format."); } } - ContainerServiceSshPublicKey IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + NodeImageVersion 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); - return DeserializeContainerServiceSshPublicKey(document.RootElement, options); + return DeserializeNodeImageVersion(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceSshPublicKey)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(NodeImageVersion)} 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/ClusterUpgradeSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs similarity index 69% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterUpgradeSettings.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs index 68bf044705f5..0c77b801f303 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ClusterUpgradeSettings.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/NodeImageVersion.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Settings for upgrading a cluster. - internal partial class ClusterUpgradeSettings + /// The node upgrade image version. + public partial class NodeImageVersion { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,22 @@ internal partial class ClusterUpgradeSettings /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ClusterUpgradeSettings() + /// Initializes a new instance of . + public NodeImageVersion() { } - /// Initializes a new instance of . - /// Settings for overrides. + /// Initializes a new instance of . + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). /// Keeps track of any properties unknown to the library. - internal ClusterUpgradeSettings(UpgradeOverrideSettings overrideSettings, IDictionary serializedAdditionalRawData) + internal NodeImageVersion(string version, IDictionary serializedAdditionalRawData) { - OverrideSettings = overrideSettings; + Version = version; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Settings for overrides. - [WirePath("overrideSettings")] - public UpgradeOverrideSettings OverrideSettings { get; set; } + /// The image version to upgrade the nodes to (e.g., 'AKSUbuntu-1804gen2containerd-2022.12.13'). + [WirePath("version")] + public string Version { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleDownMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleDownMode.cs deleted file mode 100644 index 6a27f6a1c16d..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleDownMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Describes how VMs are added to or removed from Agent Pools. See [billing states](https://docs.microsoft.com/azure/virtual-machines/states-billing). - public readonly partial struct ScaleDownMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ScaleDownMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DeleteValue = "Delete"; - private const string DeallocateValue = "Deallocate"; - - /// Create new instances during scale up and remove instances during scale down. - public static ScaleDownMode Delete { get; } = new ScaleDownMode(DeleteValue); - /// Attempt to start deallocated instances (if they exist) during scale up and deallocate instances during scale down. - public static ScaleDownMode Deallocate { get; } = new ScaleDownMode(DeallocateValue); - /// Determines if two values are the same. - public static bool operator ==(ScaleDownMode left, ScaleDownMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ScaleDownMode left, ScaleDownMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ScaleDownMode(string value) => new ScaleDownMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ScaleDownMode other && Equals(other); - /// - public bool Equals(ScaleDownMode 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/ScaleSetEvictionPolicy.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs deleted file mode 100644 index c70c6e117812..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetEvictionPolicy.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 eviction policy specifies what to do with the VM when it is evicted. The default is Delete. For more information about eviction see [spot VMs](https://docs.microsoft.com/azure/virtual-machines/spot-vms). - public readonly partial struct ScaleSetEvictionPolicy : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ScaleSetEvictionPolicy(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string DeleteValue = "Delete"; - private const string DeallocateValue = "Deallocate"; - - /// Nodes in the underlying Scale Set of the node pool are deleted when they're evicted. - public static ScaleSetEvictionPolicy Delete { get; } = new ScaleSetEvictionPolicy(DeleteValue); - /// Nodes in the underlying Scale Set of the node pool are set to the stopped-deallocated state upon eviction. Nodes in the stopped-deallocated state count against your compute quota and can cause issues with cluster scaling or upgrading. - public static ScaleSetEvictionPolicy Deallocate { get; } = new ScaleSetEvictionPolicy(DeallocateValue); - /// Determines if two values are the same. - public static bool operator ==(ScaleSetEvictionPolicy left, ScaleSetEvictionPolicy right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ScaleSetEvictionPolicy left, ScaleSetEvictionPolicy right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ScaleSetEvictionPolicy(string value) => new ScaleSetEvictionPolicy(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ScaleSetEvictionPolicy other && Equals(other); - /// - public bool Equals(ScaleSetEvictionPolicy 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/ScaleSetPriority.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetPriority.cs deleted file mode 100644 index 7e0f5bc0b497..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ScaleSetPriority.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 Virtual Machine Scale Set priority. - public readonly partial struct ScaleSetPriority : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ScaleSetPriority(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string SpotValue = "Spot"; - private const string RegularValue = "Regular"; - - /// Spot priority VMs will be used. There is no SLA for spot nodes. See [spot on AKS](https://docs.microsoft.com/azure/aks/spot-node-pool) for more information. - public static ScaleSetPriority Spot { get; } = new ScaleSetPriority(SpotValue); - /// Regular VMs will be used. - public static ScaleSetPriority Regular { get; } = new ScaleSetPriority(RegularValue); - /// Determines if two values are the same. - public static bool operator ==(ScaleSetPriority left, ScaleSetPriority right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ScaleSetPriority left, ScaleSetPriority right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ScaleSetPriority(string value) => new ScaleSetPriority(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ScaleSetPriority other && Equals(other); - /// - public bool Equals(ScaleSetPriority 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/ServiceMeshMode.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshMode.cs deleted file mode 100644 index 9b94d6e2331e..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshMode.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 the service mesh. - public readonly partial struct ServiceMeshMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ServiceMeshMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string IstioValue = "Istio"; - private const string DisabledValue = "Disabled"; - - /// Istio deployed as an AKS addon. - public static ServiceMeshMode Istio { get; } = new ServiceMeshMode(IstioValue); - /// Mesh is disabled. - public static ServiceMeshMode Disabled { get; } = new ServiceMeshMode(DisabledValue); - /// Determines if two values are the same. - public static bool operator ==(ServiceMeshMode left, ServiceMeshMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ServiceMeshMode left, ServiceMeshMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ServiceMeshMode(string value) => new ServiceMeshMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ServiceMeshMode other && Equals(other); - /// - public bool Equals(ServiceMeshMode 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/SkipProperties.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.Serialization.cs new file mode 100644 index 000000000000..1a0b89cb8fcf --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.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 SkipProperties : 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(SkipProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("targets"u8); + writer.WriteStartArray(); + foreach (var item in Targets) + { + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SkipProperties 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(SkipProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSkipProperties(document.RootElement, options); + } + + internal static SkipProperties DeserializeSkipProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList targets = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targets"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SkipTarget.DeserializeSkipTarget(item, options)); + } + targets = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SkipProperties(targets, 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(SkipProperties)} does not support writing '{options.Format}' format."); + } + } + + SkipProperties 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); + return DeserializeSkipProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SkipProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.cs similarity index 66% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.cs index a37fa3206ada..3a27ffa0b02a 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ServiceMeshProfile.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipProperties.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// Service mesh profile for a managed cluster. - public partial class ServiceMeshProfile + /// The properties of a skip operation containing multiple skip requests. + public partial class SkipProperties { /// /// Keeps track of any properties unknown to the library. @@ -45,34 +46,32 @@ public partial class ServiceMeshProfile /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Mode of the service mesh. - public ServiceMeshProfile(ServiceMeshMode mode) + /// Initializes a new instance of . + /// The targets to skip. + /// is null. + public SkipProperties(IEnumerable targets) { - Mode = mode; + Argument.AssertNotNull(targets, nameof(targets)); + + Targets = targets.ToList(); } - /// Initializes a new instance of . - /// Mode of the service mesh. - /// Istio service mesh configuration. + /// Initializes a new instance of . + /// The targets to skip. /// Keeps track of any properties unknown to the library. - internal ServiceMeshProfile(ServiceMeshMode mode, IstioServiceMesh istio, IDictionary serializedAdditionalRawData) + internal SkipProperties(IList targets, IDictionary serializedAdditionalRawData) { - Mode = mode; - Istio = istio; + Targets = targets; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ServiceMeshProfile() + /// Initializes a new instance of for deserialization. + internal SkipProperties() { } - /// Mode of the service mesh. - [WirePath("mode")] - public ServiceMeshMode Mode { get; set; } - /// Istio service mesh configuration. - [WirePath("istio")] - public IstioServiceMesh Istio { get; set; } + /// The targets to skip. + [WirePath("targets")] + public IList Targets { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.Serialization.cs similarity index 50% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.Serialization.cs index 5ce8fb97ef1f..efa277ad0e34 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterRunCommandContent.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterRunCommandContent : IUtf8JsonSerializable, IJsonModel + public partial class SkipTarget : 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); @@ -28,24 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo /// 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(ManagedClusterRunCommandContent)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(SkipTarget)} does not support writing '{format}' format."); } - writer.WritePropertyName("command"u8); - writer.WriteStringValue(Command); - if (Optional.IsDefined(Context)) - { - writer.WritePropertyName("context"u8); - writer.WriteStringValue(Context); - } - if (Optional.IsDefined(ClusterToken)) - { - writer.WritePropertyName("clusterToken"u8); - writer.WriteStringValue(ClusterToken); - } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TargetType.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -63,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterRunCommandContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + SkipTarget 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(ManagedClusterRunCommandContent)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(SkipTarget)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterRunCommandContent(document.RootElement, options); + return DeserializeSkipTarget(document.RootElement, options); } - internal static ManagedClusterRunCommandContent DeserializeManagedClusterRunCommandContent(JsonElement element, ModelReaderWriterOptions options = null) + internal static SkipTarget DeserializeSkipTarget(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -83,26 +75,20 @@ internal static ManagedClusterRunCommandContent DeserializeManagedClusterRunComm { return null; } - string command = default; - string context = default; - string clusterToken = default; + TargetType type = default; + string name = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("command"u8)) - { - command = property.Value.GetString(); - continue; - } - if (property.NameEquals("context"u8)) + if (property.NameEquals("type"u8)) { - context = property.Value.GetString(); + type = new TargetType(property.Value.GetString()); continue; } - if (property.NameEquals("clusterToken"u8)) + if (property.NameEquals("name"u8)) { - clusterToken = property.Value.GetString(); + name = property.Value.GetString(); continue; } if (options.Format != "W") @@ -111,38 +97,38 @@ internal static ManagedClusterRunCommandContent DeserializeManagedClusterRunComm } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterRunCommandContent(command, context, clusterToken, serializedAdditionalRawData); + return new SkipTarget(type, name, serializedAdditionalRawData); } - 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) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(ManagedClusterRunCommandContent)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkipTarget)} does not support writing '{options.Format}' format."); } } - ManagedClusterRunCommandContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + SkipTarget 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); - return DeserializeManagedClusterRunCommandContent(document.RootElement, options); + return DeserializeSkipTarget(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterRunCommandContent)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(SkipTarget)} 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/ContainerServiceTrustedAccessRole.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.cs similarity index 51% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.cs index 1f4bc28e0059..9fef699ffc5d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SkipTarget.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Trusted access role definition. - public partial class ContainerServiceTrustedAccessRole + /// The definition of a single skip request. + public partial class SkipTarget { /// /// Keeps track of any properties unknown to the library. @@ -45,33 +45,51 @@ public partial class ContainerServiceTrustedAccessRole /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ContainerServiceTrustedAccessRole() + /// Initializes a new instance of . + /// The skip target type. + /// + /// The skip target's name. + /// To skip a member/group/stage, use the member/group/stage's name; + /// Tp skip an after stage wait, use the parent stage's name. + /// + /// is null. + public SkipTarget(TargetType targetType, string name) { - Rules = new ChangeTrackingList(); + Argument.AssertNotNull(name, nameof(name)); + + TargetType = targetType; + Name = name; } - /// 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). + /// Initializes a new instance of . + /// The skip target type. + /// + /// The skip target's name. + /// To skip a member/group/stage, use the member/group/stage's name; + /// Tp skip an after stage wait, use the parent stage's name. + /// /// Keeps track of any properties unknown to the library. - internal ContainerServiceTrustedAccessRole(string sourceResourceType, string name, IReadOnlyList rules, IDictionary serializedAdditionalRawData) + internal SkipTarget(TargetType targetType, string name, IDictionary serializedAdditionalRawData) { - SourceResourceType = sourceResourceType; + TargetType = targetType; Name = name; - Rules = rules; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Resource type of Azure resource. - [WirePath("sourceResourceType")] - public string SourceResourceType { get; } - /// Name of role, name is unique under a source resource type. + /// Initializes a new instance of for deserialization. + internal SkipTarget() + { + } + + /// The skip target type. + [WirePath("type")] + public TargetType TargetType { get; } + /// + /// The skip target's name. + /// To skip a member/group/stage, use the member/group/stage's name; + /// Tp skip an after stage wait, use the parent stage's name. + /// [WirePath("name")] public string Name { get; } - /// 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). - [WirePath("rules")] - public IReadOnlyList Rules { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs deleted file mode 100644 index 0a958be845e9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SnapshotType.cs +++ /dev/null @@ -1,48 +0,0 @@ -// 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 type of a snapshot. The default is NodePool. - public readonly partial struct SnapshotType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public SnapshotType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NodePoolValue = "NodePool"; - - /// The snapshot is a snapshot of a node pool. - public static SnapshotType NodePool { get; } = new SnapshotType(NodePoolValue); - /// 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. - public static bool operator !=(SnapshotType left, SnapshotType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator SnapshotType(string value) => new SnapshotType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is SnapshotType other && Equals(other); - /// - public bool Equals(SnapshotType 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/SysctlConfig.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs deleted file mode 100644 index 4db64daaeb32..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.Serialization.cs +++ /dev/null @@ -1,1010 +0,0 @@ -// 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 SysctlConfig : 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(SysctlConfig)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(NetCoreSomaxconn)) - { - writer.WritePropertyName("netCoreSomaxconn"u8); - writer.WriteNumberValue(NetCoreSomaxconn.Value); - } - if (Optional.IsDefined(NetCoreNetdevMaxBacklog)) - { - writer.WritePropertyName("netCoreNetdevMaxBacklog"u8); - writer.WriteNumberValue(NetCoreNetdevMaxBacklog.Value); - } - if (Optional.IsDefined(NetCoreRmemDefault)) - { - writer.WritePropertyName("netCoreRmemDefault"u8); - writer.WriteNumberValue(NetCoreRmemDefault.Value); - } - if (Optional.IsDefined(NetCoreRmemMax)) - { - writer.WritePropertyName("netCoreRmemMax"u8); - writer.WriteNumberValue(NetCoreRmemMax.Value); - } - if (Optional.IsDefined(NetCoreWmemDefault)) - { - writer.WritePropertyName("netCoreWmemDefault"u8); - writer.WriteNumberValue(NetCoreWmemDefault.Value); - } - if (Optional.IsDefined(NetCoreWmemMax)) - { - writer.WritePropertyName("netCoreWmemMax"u8); - writer.WriteNumberValue(NetCoreWmemMax.Value); - } - if (Optional.IsDefined(NetCoreOptmemMax)) - { - writer.WritePropertyName("netCoreOptmemMax"u8); - writer.WriteNumberValue(NetCoreOptmemMax.Value); - } - if (Optional.IsDefined(NetIPv4TcpMaxSynBacklog)) - { - writer.WritePropertyName("netIpv4TcpMaxSynBacklog"u8); - writer.WriteNumberValue(NetIPv4TcpMaxSynBacklog.Value); - } - if (Optional.IsDefined(NetIPv4TcpMaxTwBuckets)) - { - writer.WritePropertyName("netIpv4TcpMaxTwBuckets"u8); - writer.WriteNumberValue(NetIPv4TcpMaxTwBuckets.Value); - } - if (Optional.IsDefined(NetIPv4TcpFinTimeout)) - { - writer.WritePropertyName("netIpv4TcpFinTimeout"u8); - writer.WriteNumberValue(NetIPv4TcpFinTimeout.Value); - } - if (Optional.IsDefined(NetIPv4TcpKeepaliveTime)) - { - writer.WritePropertyName("netIpv4TcpKeepaliveTime"u8); - writer.WriteNumberValue(NetIPv4TcpKeepaliveTime.Value); - } - if (Optional.IsDefined(NetIPv4TcpKeepaliveProbes)) - { - writer.WritePropertyName("netIpv4TcpKeepaliveProbes"u8); - writer.WriteNumberValue(NetIPv4TcpKeepaliveProbes.Value); - } - if (Optional.IsDefined(NetIPv4TcpKeepaliveIntvl)) - { - writer.WritePropertyName("netIpv4TcpkeepaliveIntvl"u8); - writer.WriteNumberValue(NetIPv4TcpKeepaliveIntvl.Value); - } - if (Optional.IsDefined(NetIPv4TcpTwReuse)) - { - writer.WritePropertyName("netIpv4TcpTwReuse"u8); - writer.WriteBooleanValue(NetIPv4TcpTwReuse.Value); - } - if (Optional.IsDefined(NetIPv4IPLocalPortRange)) - { - writer.WritePropertyName("netIpv4IpLocalPortRange"u8); - writer.WriteStringValue(NetIPv4IPLocalPortRange); - } - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh1)) - { - writer.WritePropertyName("netIpv4NeighDefaultGcThresh1"u8); - writer.WriteNumberValue(NetIPv4NeighDefaultGcThresh1.Value); - } - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh2)) - { - writer.WritePropertyName("netIpv4NeighDefaultGcThresh2"u8); - writer.WriteNumberValue(NetIPv4NeighDefaultGcThresh2.Value); - } - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh3)) - { - writer.WritePropertyName("netIpv4NeighDefaultGcThresh3"u8); - writer.WriteNumberValue(NetIPv4NeighDefaultGcThresh3.Value); - } - if (Optional.IsDefined(NetNetfilterNfConntrackMax)) - { - writer.WritePropertyName("netNetfilterNfConntrackMax"u8); - writer.WriteNumberValue(NetNetfilterNfConntrackMax.Value); - } - if (Optional.IsDefined(NetNetfilterNfConntrackBuckets)) - { - writer.WritePropertyName("netNetfilterNfConntrackBuckets"u8); - writer.WriteNumberValue(NetNetfilterNfConntrackBuckets.Value); - } - if (Optional.IsDefined(FsInotifyMaxUserWatches)) - { - writer.WritePropertyName("fsInotifyMaxUserWatches"u8); - writer.WriteNumberValue(FsInotifyMaxUserWatches.Value); - } - if (Optional.IsDefined(FsFileMax)) - { - writer.WritePropertyName("fsFileMax"u8); - writer.WriteNumberValue(FsFileMax.Value); - } - if (Optional.IsDefined(FsAioMaxNr)) - { - writer.WritePropertyName("fsAioMaxNr"u8); - writer.WriteNumberValue(FsAioMaxNr.Value); - } - if (Optional.IsDefined(FsNrOpen)) - { - writer.WritePropertyName("fsNrOpen"u8); - writer.WriteNumberValue(FsNrOpen.Value); - } - if (Optional.IsDefined(KernelThreadsMax)) - { - writer.WritePropertyName("kernelThreadsMax"u8); - writer.WriteNumberValue(KernelThreadsMax.Value); - } - if (Optional.IsDefined(VmMaxMapCount)) - { - writer.WritePropertyName("vmMaxMapCount"u8); - writer.WriteNumberValue(VmMaxMapCount.Value); - } - if (Optional.IsDefined(VmSwappiness)) - { - writer.WritePropertyName("vmSwappiness"u8); - writer.WriteNumberValue(VmSwappiness.Value); - } - if (Optional.IsDefined(VmVfsCachePressure)) - { - writer.WritePropertyName("vmVfsCachePressure"u8); - writer.WriteNumberValue(VmVfsCachePressure.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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - SysctlConfig 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(SysctlConfig)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSysctlConfig(document.RootElement, options); - } - - internal static SysctlConfig DeserializeSysctlConfig(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - int? netCoreSomaxconn = default; - int? netCoreNetdevMaxBacklog = default; - int? netCoreRmemDefault = default; - int? netCoreRmemMax = default; - int? netCoreWmemDefault = default; - int? netCoreWmemMax = default; - int? netCoreOptmemMax = default; - int? netIPv4TcpMaxSynBacklog = default; - int? netIPv4TcpMaxTwBuckets = default; - int? netIPv4TcpFinTimeout = default; - int? netIPv4TcpKeepaliveTime = default; - int? netIPv4TcpKeepaliveProbes = default; - int? netIPv4TcpKeepaliveIntvl = default; - bool? netIPv4TcpTwReuse = default; - string netIPv4IPLocalPortRange = default; - int? netIPv4NeighDefaultGcThresh1 = default; - int? netIPv4NeighDefaultGcThresh2 = default; - int? netIPv4NeighDefaultGcThresh3 = default; - int? netNetfilterNfConntrackMax = default; - int? netNetfilterNfConntrackBuckets = default; - int? fsInotifyMaxUserWatches = default; - int? fsFileMax = default; - int? fsAioMaxNr = default; - int? fsNrOpen = default; - int? kernelThreadsMax = default; - int? vmMaxMapCount = default; - int? vmSwappiness = default; - int? vmVfsCachePressure = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("netCoreSomaxconn"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreSomaxconn = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreNetdevMaxBacklog"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreNetdevMaxBacklog = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreRmemDefault"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreRmemDefault = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreRmemMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreRmemMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreWmemDefault"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreWmemDefault = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreWmemMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreWmemMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netCoreOptmemMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netCoreOptmemMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpMaxSynBacklog"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpMaxSynBacklog = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpMaxTwBuckets"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpMaxTwBuckets = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpFinTimeout"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpFinTimeout = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpKeepaliveTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpKeepaliveTime = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpKeepaliveProbes"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpKeepaliveProbes = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpkeepaliveIntvl"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpKeepaliveIntvl = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4TcpTwReuse"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4TcpTwReuse = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("netIpv4IpLocalPortRange"u8)) - { - netIPv4IPLocalPortRange = property.Value.GetString(); - continue; - } - if (property.NameEquals("netIpv4NeighDefaultGcThresh1"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4NeighDefaultGcThresh1 = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4NeighDefaultGcThresh2"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4NeighDefaultGcThresh2 = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netIpv4NeighDefaultGcThresh3"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netIPv4NeighDefaultGcThresh3 = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netNetfilterNfConntrackMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netNetfilterNfConntrackMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("netNetfilterNfConntrackBuckets"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - netNetfilterNfConntrackBuckets = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("fsInotifyMaxUserWatches"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fsInotifyMaxUserWatches = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("fsFileMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fsFileMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("fsAioMaxNr"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fsAioMaxNr = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("fsNrOpen"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - fsNrOpen = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("kernelThreadsMax"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - kernelThreadsMax = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("vmMaxMapCount"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmMaxMapCount = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("vmSwappiness"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmSwappiness = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("vmVfsCachePressure"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - vmVfsCachePressure = property.Value.GetInt32(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new SysctlConfig( - netCoreSomaxconn, - netCoreNetdevMaxBacklog, - netCoreRmemDefault, - netCoreRmemMax, - netCoreWmemDefault, - netCoreWmemMax, - netCoreOptmemMax, - netIPv4TcpMaxSynBacklog, - netIPv4TcpMaxTwBuckets, - netIPv4TcpFinTimeout, - netIPv4TcpKeepaliveTime, - netIPv4TcpKeepaliveProbes, - netIPv4TcpKeepaliveIntvl, - netIPv4TcpTwReuse, - netIPv4IPLocalPortRange, - netIPv4NeighDefaultGcThresh1, - netIPv4NeighDefaultGcThresh2, - netIPv4NeighDefaultGcThresh3, - netNetfilterNfConntrackMax, - netNetfilterNfConntrackBuckets, - fsInotifyMaxUserWatches, - fsFileMax, - fsAioMaxNr, - fsNrOpen, - kernelThreadsMax, - vmMaxMapCount, - vmSwappiness, - vmVfsCachePressure, - 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(NetCoreSomaxconn), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreSomaxconn: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreSomaxconn)) - { - builder.Append(" netCoreSomaxconn: "); - builder.AppendLine($"{NetCoreSomaxconn.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreNetdevMaxBacklog), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreNetdevMaxBacklog: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreNetdevMaxBacklog)) - { - builder.Append(" netCoreNetdevMaxBacklog: "); - builder.AppendLine($"{NetCoreNetdevMaxBacklog.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreRmemDefault), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreRmemDefault: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreRmemDefault)) - { - builder.Append(" netCoreRmemDefault: "); - builder.AppendLine($"{NetCoreRmemDefault.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreRmemMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreRmemMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreRmemMax)) - { - builder.Append(" netCoreRmemMax: "); - builder.AppendLine($"{NetCoreRmemMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreWmemDefault), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreWmemDefault: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreWmemDefault)) - { - builder.Append(" netCoreWmemDefault: "); - builder.AppendLine($"{NetCoreWmemDefault.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreWmemMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreWmemMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreWmemMax)) - { - builder.Append(" netCoreWmemMax: "); - builder.AppendLine($"{NetCoreWmemMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetCoreOptmemMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netCoreOptmemMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetCoreOptmemMax)) - { - builder.Append(" netCoreOptmemMax: "); - builder.AppendLine($"{NetCoreOptmemMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpMaxSynBacklog), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpMaxSynBacklog: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpMaxSynBacklog)) - { - builder.Append(" netIpv4TcpMaxSynBacklog: "); - builder.AppendLine($"{NetIPv4TcpMaxSynBacklog.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpMaxTwBuckets), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpMaxTwBuckets: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpMaxTwBuckets)) - { - builder.Append(" netIpv4TcpMaxTwBuckets: "); - builder.AppendLine($"{NetIPv4TcpMaxTwBuckets.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpFinTimeout), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpFinTimeout: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpFinTimeout)) - { - builder.Append(" netIpv4TcpFinTimeout: "); - builder.AppendLine($"{NetIPv4TcpFinTimeout.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpKeepaliveTime), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpKeepaliveTime: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpKeepaliveTime)) - { - builder.Append(" netIpv4TcpKeepaliveTime: "); - builder.AppendLine($"{NetIPv4TcpKeepaliveTime.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpKeepaliveProbes), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpKeepaliveProbes: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpKeepaliveProbes)) - { - builder.Append(" netIpv4TcpKeepaliveProbes: "); - builder.AppendLine($"{NetIPv4TcpKeepaliveProbes.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpKeepaliveIntvl), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpkeepaliveIntvl: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpKeepaliveIntvl)) - { - builder.Append(" netIpv4TcpkeepaliveIntvl: "); - builder.AppendLine($"{NetIPv4TcpKeepaliveIntvl.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4TcpTwReuse), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4TcpTwReuse: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4TcpTwReuse)) - { - builder.Append(" netIpv4TcpTwReuse: "); - var boolValue = NetIPv4TcpTwReuse.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4IPLocalPortRange), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4IpLocalPortRange: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4IPLocalPortRange)) - { - builder.Append(" netIpv4IpLocalPortRange: "); - if (NetIPv4IPLocalPortRange.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{NetIPv4IPLocalPortRange}'''"); - } - else - { - builder.AppendLine($"'{NetIPv4IPLocalPortRange}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4NeighDefaultGcThresh1), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4NeighDefaultGcThresh1: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh1)) - { - builder.Append(" netIpv4NeighDefaultGcThresh1: "); - builder.AppendLine($"{NetIPv4NeighDefaultGcThresh1.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4NeighDefaultGcThresh2), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4NeighDefaultGcThresh2: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh2)) - { - builder.Append(" netIpv4NeighDefaultGcThresh2: "); - builder.AppendLine($"{NetIPv4NeighDefaultGcThresh2.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetIPv4NeighDefaultGcThresh3), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netIpv4NeighDefaultGcThresh3: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetIPv4NeighDefaultGcThresh3)) - { - builder.Append(" netIpv4NeighDefaultGcThresh3: "); - builder.AppendLine($"{NetIPv4NeighDefaultGcThresh3.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetNetfilterNfConntrackMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netNetfilterNfConntrackMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetNetfilterNfConntrackMax)) - { - builder.Append(" netNetfilterNfConntrackMax: "); - builder.AppendLine($"{NetNetfilterNfConntrackMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetNetfilterNfConntrackBuckets), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" netNetfilterNfConntrackBuckets: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(NetNetfilterNfConntrackBuckets)) - { - builder.Append(" netNetfilterNfConntrackBuckets: "); - builder.AppendLine($"{NetNetfilterNfConntrackBuckets.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FsInotifyMaxUserWatches), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fsInotifyMaxUserWatches: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FsInotifyMaxUserWatches)) - { - builder.Append(" fsInotifyMaxUserWatches: "); - builder.AppendLine($"{FsInotifyMaxUserWatches.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FsFileMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fsFileMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FsFileMax)) - { - builder.Append(" fsFileMax: "); - builder.AppendLine($"{FsFileMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FsAioMaxNr), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fsAioMaxNr: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FsAioMaxNr)) - { - builder.Append(" fsAioMaxNr: "); - builder.AppendLine($"{FsAioMaxNr.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FsNrOpen), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" fsNrOpen: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(FsNrOpen)) - { - builder.Append(" fsNrOpen: "); - builder.AppendLine($"{FsNrOpen.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KernelThreadsMax), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kernelThreadsMax: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(KernelThreadsMax)) - { - builder.Append(" kernelThreadsMax: "); - builder.AppendLine($"{KernelThreadsMax.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmMaxMapCount), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmMaxMapCount: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmMaxMapCount)) - { - builder.Append(" vmMaxMapCount: "); - builder.AppendLine($"{VmMaxMapCount.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmSwappiness), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmSwappiness: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmSwappiness)) - { - builder.Append(" vmSwappiness: "); - builder.AppendLine($"{VmSwappiness.Value}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmVfsCachePressure), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" vmVfsCachePressure: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(VmVfsCachePressure)) - { - builder.Append(" vmVfsCachePressure: "); - builder.AppendLine($"{VmVfsCachePressure.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(SysctlConfig)} does not support writing '{options.Format}' format."); - } - } - - SysctlConfig 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); - return DeserializeSysctlConfig(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(SysctlConfig)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs deleted file mode 100644 index 100ed4abe27f..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/SysctlConfig.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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 -{ - /// Sysctl settings for Linux agent nodes. - public partial class SysctlConfig - { - /// - /// 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 SysctlConfig() - { - } - - /// Initializes a new instance of . - /// Sysctl setting net.core.somaxconn. - /// Sysctl setting net.core.netdev_max_backlog. - /// Sysctl setting net.core.rmem_default. - /// Sysctl setting net.core.rmem_max. - /// Sysctl setting net.core.wmem_default. - /// Sysctl setting net.core.wmem_max. - /// Sysctl setting net.core.optmem_max. - /// Sysctl setting net.ipv4.tcp_max_syn_backlog. - /// Sysctl setting net.ipv4.tcp_max_tw_buckets. - /// Sysctl setting net.ipv4.tcp_fin_timeout. - /// Sysctl setting net.ipv4.tcp_keepalive_time. - /// Sysctl setting net.ipv4.tcp_keepalive_probes. - /// Sysctl setting net.ipv4.tcp_keepalive_intvl. - /// Sysctl setting net.ipv4.tcp_tw_reuse. - /// Sysctl setting net.ipv4.ip_local_port_range. - /// Sysctl setting net.ipv4.neigh.default.gc_thresh1. - /// Sysctl setting net.ipv4.neigh.default.gc_thresh2. - /// Sysctl setting net.ipv4.neigh.default.gc_thresh3. - /// Sysctl setting net.netfilter.nf_conntrack_max. - /// Sysctl setting net.netfilter.nf_conntrack_buckets. - /// Sysctl setting fs.inotify.max_user_watches. - /// Sysctl setting fs.file-max. - /// Sysctl setting fs.aio-max-nr. - /// Sysctl setting fs.nr_open. - /// Sysctl setting kernel.threads-max. - /// Sysctl setting vm.max_map_count. - /// Sysctl setting vm.swappiness. - /// Sysctl setting vm.vfs_cache_pressure. - /// Keeps track of any properties unknown to the library. - internal SysctlConfig(int? netCoreSomaxconn, int? netCoreNetdevMaxBacklog, int? netCoreRmemDefault, int? netCoreRmemMax, int? netCoreWmemDefault, int? netCoreWmemMax, int? netCoreOptmemMax, int? netIPv4TcpMaxSynBacklog, int? netIPv4TcpMaxTwBuckets, int? netIPv4TcpFinTimeout, int? netIPv4TcpKeepaliveTime, int? netIPv4TcpKeepaliveProbes, int? netIPv4TcpKeepaliveIntvl, bool? netIPv4TcpTwReuse, string netIPv4IPLocalPortRange, int? netIPv4NeighDefaultGcThresh1, int? netIPv4NeighDefaultGcThresh2, int? netIPv4NeighDefaultGcThresh3, int? netNetfilterNfConntrackMax, int? netNetfilterNfConntrackBuckets, int? fsInotifyMaxUserWatches, int? fsFileMax, int? fsAioMaxNr, int? fsNrOpen, int? kernelThreadsMax, int? vmMaxMapCount, int? vmSwappiness, int? vmVfsCachePressure, IDictionary serializedAdditionalRawData) - { - NetCoreSomaxconn = netCoreSomaxconn; - NetCoreNetdevMaxBacklog = netCoreNetdevMaxBacklog; - NetCoreRmemDefault = netCoreRmemDefault; - NetCoreRmemMax = netCoreRmemMax; - NetCoreWmemDefault = netCoreWmemDefault; - NetCoreWmemMax = netCoreWmemMax; - NetCoreOptmemMax = netCoreOptmemMax; - NetIPv4TcpMaxSynBacklog = netIPv4TcpMaxSynBacklog; - NetIPv4TcpMaxTwBuckets = netIPv4TcpMaxTwBuckets; - NetIPv4TcpFinTimeout = netIPv4TcpFinTimeout; - NetIPv4TcpKeepaliveTime = netIPv4TcpKeepaliveTime; - NetIPv4TcpKeepaliveProbes = netIPv4TcpKeepaliveProbes; - NetIPv4TcpKeepaliveIntvl = netIPv4TcpKeepaliveIntvl; - NetIPv4TcpTwReuse = netIPv4TcpTwReuse; - NetIPv4IPLocalPortRange = netIPv4IPLocalPortRange; - NetIPv4NeighDefaultGcThresh1 = netIPv4NeighDefaultGcThresh1; - NetIPv4NeighDefaultGcThresh2 = netIPv4NeighDefaultGcThresh2; - NetIPv4NeighDefaultGcThresh3 = netIPv4NeighDefaultGcThresh3; - NetNetfilterNfConntrackMax = netNetfilterNfConntrackMax; - NetNetfilterNfConntrackBuckets = netNetfilterNfConntrackBuckets; - FsInotifyMaxUserWatches = fsInotifyMaxUserWatches; - FsFileMax = fsFileMax; - FsAioMaxNr = fsAioMaxNr; - FsNrOpen = fsNrOpen; - KernelThreadsMax = kernelThreadsMax; - VmMaxMapCount = vmMaxMapCount; - VmSwappiness = vmSwappiness; - VmVfsCachePressure = vmVfsCachePressure; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Sysctl setting net.core.somaxconn. - [WirePath("netCoreSomaxconn")] - public int? NetCoreSomaxconn { get; set; } - /// Sysctl setting net.core.netdev_max_backlog. - [WirePath("netCoreNetdevMaxBacklog")] - public int? NetCoreNetdevMaxBacklog { get; set; } - /// Sysctl setting net.core.rmem_default. - [WirePath("netCoreRmemDefault")] - public int? NetCoreRmemDefault { get; set; } - /// Sysctl setting net.core.rmem_max. - [WirePath("netCoreRmemMax")] - public int? NetCoreRmemMax { get; set; } - /// Sysctl setting net.core.wmem_default. - [WirePath("netCoreWmemDefault")] - public int? NetCoreWmemDefault { get; set; } - /// Sysctl setting net.core.wmem_max. - [WirePath("netCoreWmemMax")] - public int? NetCoreWmemMax { get; set; } - /// Sysctl setting net.core.optmem_max. - [WirePath("netCoreOptmemMax")] - public int? NetCoreOptmemMax { get; set; } - /// Sysctl setting net.ipv4.tcp_max_syn_backlog. - [WirePath("netIpv4TcpMaxSynBacklog")] - public int? NetIPv4TcpMaxSynBacklog { get; set; } - /// Sysctl setting net.ipv4.tcp_max_tw_buckets. - [WirePath("netIpv4TcpMaxTwBuckets")] - public int? NetIPv4TcpMaxTwBuckets { get; set; } - /// Sysctl setting net.ipv4.tcp_fin_timeout. - [WirePath("netIpv4TcpFinTimeout")] - public int? NetIPv4TcpFinTimeout { get; set; } - /// Sysctl setting net.ipv4.tcp_keepalive_time. - [WirePath("netIpv4TcpKeepaliveTime")] - public int? NetIPv4TcpKeepaliveTime { get; set; } - /// Sysctl setting net.ipv4.tcp_keepalive_probes. - [WirePath("netIpv4TcpKeepaliveProbes")] - public int? NetIPv4TcpKeepaliveProbes { get; set; } - /// Sysctl setting net.ipv4.tcp_keepalive_intvl. - [WirePath("netIpv4TcpkeepaliveIntvl")] - public int? NetIPv4TcpKeepaliveIntvl { get; set; } - /// Sysctl setting net.ipv4.tcp_tw_reuse. - [WirePath("netIpv4TcpTwReuse")] - public bool? NetIPv4TcpTwReuse { get; set; } - /// Sysctl setting net.ipv4.ip_local_port_range. - [WirePath("netIpv4IpLocalPortRange")] - public string NetIPv4IPLocalPortRange { get; set; } - /// Sysctl setting net.ipv4.neigh.default.gc_thresh1. - [WirePath("netIpv4NeighDefaultGcThresh1")] - public int? NetIPv4NeighDefaultGcThresh1 { get; set; } - /// Sysctl setting net.ipv4.neigh.default.gc_thresh2. - [WirePath("netIpv4NeighDefaultGcThresh2")] - public int? NetIPv4NeighDefaultGcThresh2 { get; set; } - /// Sysctl setting net.ipv4.neigh.default.gc_thresh3. - [WirePath("netIpv4NeighDefaultGcThresh3")] - public int? NetIPv4NeighDefaultGcThresh3 { get; set; } - /// Sysctl setting net.netfilter.nf_conntrack_max. - [WirePath("netNetfilterNfConntrackMax")] - public int? NetNetfilterNfConntrackMax { get; set; } - /// Sysctl setting net.netfilter.nf_conntrack_buckets. - [WirePath("netNetfilterNfConntrackBuckets")] - public int? NetNetfilterNfConntrackBuckets { get; set; } - /// Sysctl setting fs.inotify.max_user_watches. - [WirePath("fsInotifyMaxUserWatches")] - public int? FsInotifyMaxUserWatches { get; set; } - /// Sysctl setting fs.file-max. - [WirePath("fsFileMax")] - public int? FsFileMax { get; set; } - /// Sysctl setting fs.aio-max-nr. - [WirePath("fsAioMaxNr")] - public int? FsAioMaxNr { get; set; } - /// Sysctl setting fs.nr_open. - [WirePath("fsNrOpen")] - public int? FsNrOpen { get; set; } - /// Sysctl setting kernel.threads-max. - [WirePath("kernelThreadsMax")] - public int? KernelThreadsMax { get; set; } - /// Sysctl setting vm.max_map_count. - [WirePath("vmMaxMapCount")] - public int? VmMaxMapCount { get; set; } - /// Sysctl setting vm.swappiness. - [WirePath("vmSwappiness")] - public int? VmSwappiness { get; set; } - /// Sysctl setting vm.vfs_cache_pressure. - [WirePath("vmVfsCachePressure")] - public int? VmVfsCachePressure { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TargetType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TargetType.cs new file mode 100644 index 000000000000..4571582b2fb7 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TargetType.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 +{ + /// The target type of a skip request. + public readonly partial struct TargetType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TargetType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MemberValue = "Member"; + private const string GroupValue = "Group"; + private const string StageValue = "Stage"; + private const string AfterStageWaitValue = "AfterStageWait"; + + /// Skip the update of a member. + public static TargetType Member { get; } = new TargetType(MemberValue); + /// Skip the update of a group. + public static TargetType Group { get; } = new TargetType(GroupValue); + /// Skip the update of an entire stage including the after stage wait. + public static TargetType Stage { get; } = new TargetType(StageValue); + /// Skip the update of the after stage wait of a certain stage. + public static TargetType AfterStageWait { get; } = new TargetType(AfterStageWaitValue); + /// Determines if two values are the same. + public static bool operator ==(TargetType left, TargetType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TargetType left, TargetType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TargetType(string value) => new TargetType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TargetType other && Equals(other); + /// + public bool Equals(TargetType 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/TrustedAccessRoleBindingListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs deleted file mode 100644 index 86b7caa9fe79..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleBindingListResult.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 TrustedAccessRoleBindingListResult : 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(TrustedAccessRoleBindingListResult)} 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - TrustedAccessRoleBindingListResult 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(TrustedAccessRoleBindingListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTrustedAccessRoleBindingListResult(document.RootElement, options); - } - - internal static TrustedAccessRoleBindingListResult DeserializeTrustedAccessRoleBindingListResult(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(ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(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 TrustedAccessRoleBindingListResult(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(TrustedAccessRoleBindingListResult)} does not support writing '{options.Format}' format."); - } - } - - TrustedAccessRoleBindingListResult 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); - return DeserializeTrustedAccessRoleBindingListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(TrustedAccessRoleBindingListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs deleted file mode 100644 index c13868bc0f60..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.Serialization.cs +++ /dev/null @@ -1,219 +0,0 @@ -// 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 TrustedAccessRoleListResult : 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(TrustedAccessRoleListResult)} 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); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - TrustedAccessRoleListResult 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(TrustedAccessRoleListResult)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeTrustedAccessRoleListResult(document.RootElement, options); - } - - internal static TrustedAccessRoleListResult DeserializeTrustedAccessRoleListResult(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(ContainerServiceTrustedAccessRole.DeserializeContainerServiceTrustedAccessRole(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 TrustedAccessRoleListResult(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(TrustedAccessRoleListResult)} does not support writing '{options.Format}' format."); - } - } - - TrustedAccessRoleListResult 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); - return DeserializeTrustedAccessRoleListResult(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(TrustedAccessRoleListResult)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs deleted file mode 100644 index 6a5ecc232b67..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/TrustedAccessRoleListResult.cs +++ /dev/null @@ -1,70 +0,0 @@ -// 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 -{ - /// List of trusted access roles. - internal partial class TrustedAccessRoleListResult - { - /// - /// 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 TrustedAccessRoleListResult() - { - Value = new ChangeTrackingList(); - } - - /// Initializes a new instance of . - /// Role list. - /// Link to next page of resources. - /// Keeps track of any properties unknown to the library. - internal TrustedAccessRoleListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) - { - Value = value; - NextLink = nextLink; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Role list. - public IReadOnlyList Value { get; } - /// Link to next page of resources. - public string NextLink { get; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.Serialization.cs similarity index 62% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.Serialization.cs index 26b4ff0c3b79..a05b1f2a0c0c 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/DailySchedule.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - internal partial class DailySchedule : IUtf8JsonSerializable, IJsonModel + public partial class UpdateGroup : 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,14 +29,14 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt /// 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(DailySchedule)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateGroup)} does not support writing '{format}' format."); } - writer.WritePropertyName("intervalDays"u8); - writer.WriteNumberValue(IntervalDays); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -54,19 +54,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - DailySchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateGroup 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(DailySchedule)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateGroup)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeDailySchedule(document.RootElement, options); + return DeserializeUpdateGroup(document.RootElement, options); } - internal static DailySchedule DeserializeDailySchedule(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateGroup DeserializeUpdateGroup(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -74,14 +74,14 @@ internal static DailySchedule DeserializeDailySchedule(JsonElement element, Mode { return null; } - int intervalDays = default; + string name = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("intervalDays"u8)) + if (property.NameEquals("name"u8)) { - intervalDays = property.Value.GetInt32(); + name = property.Value.GetString(); continue; } if (options.Format != "W") @@ -90,7 +90,7 @@ internal static DailySchedule DeserializeDailySchedule(JsonElement element, Mode } } serializedAdditionalRawData = rawDataDictionary; - return new DailySchedule(intervalDays, serializedAdditionalRawData); + return new UpdateGroup(name, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -104,25 +104,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IntervalDays), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" intervalDays: "); + builder.Append(" name: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" intervalDays: "); - builder.AppendLine($"{IntervalDays}"); + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } } 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) { @@ -131,26 +142,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions optio case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(DailySchedule)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateGroup)} does not support writing '{options.Format}' format."); } } - DailySchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateGroup 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); - return DeserializeDailySchedule(document.RootElement, options); + return DeserializeUpdateGroup(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(DailySchedule)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateGroup)} 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/CompatibleVersions.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/CompatibleVersions.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.cs index dbb7722a8aa6..3569ef8bc997 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/CompatibleVersions.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroup.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Version information about a product/service that is compatible with a service mesh revision. - public partial class CompatibleVersions + /// A group to be updated. + public partial class UpdateGroup { /// /// Keeps track of any properties unknown to the library. @@ -45,28 +45,41 @@ public partial class CompatibleVersions /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public CompatibleVersions() + /// Initializes a new instance of . + /// + /// Name of the group. + /// It must match a group name of an existing fleet member. + /// + /// is null. + public UpdateGroup(string name) { - Versions = new ChangeTrackingList(); + Argument.AssertNotNull(name, nameof(name)); + + Name = name; } - /// Initializes a new instance of . - /// The product/service name. - /// Product/service versions compatible with a service mesh add-on revision. + /// Initializes a new instance of . + /// + /// Name of the group. + /// It must match a group name of an existing fleet member. + /// /// Keeps track of any properties unknown to the library. - internal CompatibleVersions(string name, IList versions, IDictionary serializedAdditionalRawData) + internal UpdateGroup(string name, IDictionary serializedAdditionalRawData) { Name = name; - Versions = versions; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The product/service name. + /// Initializes a new instance of for deserialization. + internal UpdateGroup() + { + } + + /// + /// Name of the group. + /// It must match a group name of an existing fleet member. + /// [WirePath("name")] public string Name { get; set; } - /// Product/service versions compatible with a service mesh add-on revision. - [WirePath("versions")] - public IList Versions { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.Serialization.cs similarity index 61% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.Serialization.cs index 0e3330402797..9fa861247420 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTrustedAccessRole.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTrustedAccessRole : IUtf8JsonSerializable, IJsonModel + public partial class UpdateGroupStatus : 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); @@ -30,27 +30,27 @@ void IJsonModel.Write(Utf8JsonWriter 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; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRole)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateGroupStatus)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsDefined(SourceResourceType)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("sourceResourceType"u8); - writer.WriteStringValue(SourceResourceType); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } if (options.Format != "W" && Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } - if (options.Format != "W" && Optional.IsCollectionDefined(Rules)) + if (options.Format != "W" && Optional.IsCollectionDefined(Members)) { - writer.WritePropertyName("rules"u8); + writer.WritePropertyName("members"u8); writer.WriteStartArray(); - foreach (var item in Rules) + foreach (var item in Members) { writer.WriteObjectValue(item, options); } @@ -73,19 +73,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceTrustedAccessRole IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateGroupStatus 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(ContainerServiceTrustedAccessRole)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateGroupStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTrustedAccessRole(document.RootElement, options); + return DeserializeUpdateGroupStatus(document.RootElement, options); } - internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTrustedAccessRole(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateGroupStatus DeserializeUpdateGroupStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,16 +93,20 @@ internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTru { return null; } - string sourceResourceType = default; + UpdateStatus status = default; string name = default; - IReadOnlyList rules = default; + IReadOnlyList members = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sourceResourceType"u8)) + if (property.NameEquals("status"u8)) { - sourceResourceType = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = UpdateStatus.DeserializeUpdateStatus(property.Value, options); continue; } if (property.NameEquals("name"u8)) @@ -110,18 +114,18 @@ internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTru name = property.Value.GetString(); continue; } - if (property.NameEquals("rules"u8)) + if (property.NameEquals("members"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ContainerServiceTrustedAccessRoleRule.DeserializeContainerServiceTrustedAccessRoleRule(item, options)); + array.Add(MemberUpdateStatus.DeserializeMemberUpdateStatus(item, options)); } - rules = array; + members = array; continue; } if (options.Format != "W") @@ -130,7 +134,7 @@ internal static ContainerServiceTrustedAccessRole DeserializeContainerServiceTru } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTrustedAccessRole(sourceResourceType, name, rules ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UpdateGroupStatus(status, name, members ?? new ChangeTrackingList(), serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -144,26 +148,18 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceResourceType), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" sourceResourceType: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SourceResourceType)) + if (Optional.IsDefined(Status)) { - builder.Append(" sourceResourceType: "); - if (SourceResourceType.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SourceResourceType}'''"); - } - else - { - builder.AppendLine($"'{SourceResourceType}'"); - } + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); } } @@ -190,23 +186,23 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Rules), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Members), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" rules: "); + builder.Append(" members: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(Rules)) + if (Optional.IsCollectionDefined(Members)) { - if (Rules.Any()) + if (Members.Any()) { - builder.Append(" rules: "); + builder.Append(" members: "); builder.AppendLine("["); - foreach (var item in Rules) + foreach (var item in Members) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " rules: "); + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " members: "); } builder.AppendLine(" ]"); } @@ -217,9 +213,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -228,26 +224,26 @@ BinaryData IPersistableModel.Write(ModelReade case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRole)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateGroupStatus)} does not support writing '{options.Format}' format."); } } - ContainerServiceTrustedAccessRole IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateGroupStatus 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); - return DeserializeContainerServiceTrustedAccessRole(document.RootElement, options); + return DeserializeUpdateGroupStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRole)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateGroupStatus)} 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/ContainerServicePrivateLinkServiceConnectionState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.cs index fa7c96067db2..86700dd3f003 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePrivateLinkServiceConnectionState.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateGroupStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// The state of a private link service connection. - public partial class ContainerServicePrivateLinkServiceConnectionState + /// The status of a UpdateGroup. + public partial class UpdateGroupStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,33 @@ public partial class ContainerServicePrivateLinkServiceConnectionState /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ContainerServicePrivateLinkServiceConnectionState() + /// Initializes a new instance of . + internal UpdateGroupStatus() { + Members = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The private link service connection status. - /// The private link service connection description. + /// Initializes a new instance of . + /// The status of the UpdateGroup. + /// The name of the UpdateGroup. + /// The list of member this UpdateGroup updates. /// Keeps track of any properties unknown to the library. - internal ContainerServicePrivateLinkServiceConnectionState(ContainerServicePrivateLinkServiceConnectionStatus? status, string description, IDictionary serializedAdditionalRawData) + internal UpdateGroupStatus(UpdateStatus status, string name, IReadOnlyList members, IDictionary serializedAdditionalRawData) { Status = status; - Description = description; + Name = name; + Members = members; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The private link service connection status. + /// The status of the UpdateGroup. [WirePath("status")] - public ContainerServicePrivateLinkServiceConnectionStatus? Status { get; set; } - /// The private link service connection description. - [WirePath("description")] - public string Description { get; set; } + public UpdateStatus Status { get; } + /// The name of the UpdateGroup. + [WirePath("name")] + public string Name { get; } + /// The list of member this UpdateGroup updates. + [WirePath("members")] + public IReadOnlyList Members { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.Serialization.cs new file mode 100644 index 000000000000..e8ff43812b29 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.Serialization.cs @@ -0,0 +1,208 @@ +// 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 UpdateRunListResult : 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(UpdateRunListResult)} does not support writing '{format}' format."); + } + + 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.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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateRunListResult 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(UpdateRunListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateRunListResult(document.RootElement, options); + } + + internal static UpdateRunListResult DeserializeUpdateRunListResult(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)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UpdateRunData.DeserializeUpdateRunData(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 UpdateRunListResult(value, 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(UpdateRunListResult)} does not support writing '{options.Format}' format."); + } + } + + UpdateRunListResult 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); + return DeserializeUpdateRunListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateRunListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.cs similarity index 58% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.cs index 3870f8d6d37a..91cd7d68193d 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceMaintenanceConfigurationListResult.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunListResult.cs @@ -7,11 +7,12 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// The response from the List maintenance configurations operation. - internal partial class ContainerServiceMaintenanceConfigurationListResult + /// The response of a UpdateRun list operation. + internal partial class UpdateRunListResult { /// /// Keeps track of any properties unknown to the library. @@ -45,26 +46,35 @@ internal partial class ContainerServiceMaintenanceConfigurationListResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal ContainerServiceMaintenanceConfigurationListResult() + /// Initializes a new instance of . + /// The UpdateRun items on this page. + /// is null. + internal UpdateRunListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); } - /// Initializes a new instance of . - /// The list of maintenance configurations. - /// The URL to get the next set of maintenance configuration results. + /// Initializes a new instance of . + /// The UpdateRun items on this page. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal ContainerServiceMaintenanceConfigurationListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal UpdateRunListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The list of maintenance configurations. - public IReadOnlyList Value { get; } - /// The URL to get the next set of maintenance configuration results. - public string NextLink { get; } + /// Initializes a new instance of for deserialization. + internal UpdateRunListResult() + { + } + + /// The UpdateRun items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunProvisioningState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunProvisioningState.cs new file mode 100644 index 000000000000..01875463051a --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunProvisioningState.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 provisioning state of the UpdateRun resource. + public readonly partial struct UpdateRunProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public UpdateRunProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static UpdateRunProvisioningState Succeeded { get; } = new UpdateRunProvisioningState(SucceededValue); + /// Resource creation failed. + public static UpdateRunProvisioningState Failed { get; } = new UpdateRunProvisioningState(FailedValue); + /// Resource creation was canceled. + public static UpdateRunProvisioningState Canceled { get; } = new UpdateRunProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(UpdateRunProvisioningState left, UpdateRunProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UpdateRunProvisioningState left, UpdateRunProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator UpdateRunProvisioningState(string value) => new UpdateRunProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UpdateRunProvisioningState other && Equals(other); + /// + public bool Equals(UpdateRunProvisioningState 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/IstioComponents.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.Serialization.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.Serialization.cs index 4861c4ab459d..0e92c6d402ea 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/IstioComponents.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class IstioComponents : IUtf8JsonSerializable, IJsonModel + public partial class UpdateRunStatus : 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); @@ -30,32 +30,32 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO /// 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(IstioComponents)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStatus)} does not support writing '{format}' format."); } - if (Optional.IsCollectionDefined(IngressGateways)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("ingressGateways"u8); - writer.WriteStartArray(); - foreach (var item in IngressGateways) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } - if (Optional.IsCollectionDefined(EgressGateways)) + if (options.Format != "W" && Optional.IsCollectionDefined(Stages)) { - writer.WritePropertyName("egressGateways"u8); + writer.WritePropertyName("stages"u8); writer.WriteStartArray(); - foreach (var item in EgressGateways) + foreach (var item in Stages) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsDefined(NodeImageSelection)) + { + writer.WritePropertyName("nodeImageSelection"u8); + writer.WriteObjectValue(NodeImageSelection, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -73,19 +73,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - IstioComponents IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateRunStatus 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(IstioComponents)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeIstioComponents(document.RootElement, options); + return DeserializeUpdateRunStatus(document.RootElement, options); } - internal static IstioComponents DeserializeIstioComponents(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateRunStatus DeserializeUpdateRunStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,38 +93,43 @@ internal static IstioComponents DeserializeIstioComponents(JsonElement element, { return null; } - IList ingressGateways = default; - IList egressGateways = default; + UpdateStatus status = default; + IReadOnlyList stages = default; + NodeImageSelectionStatus nodeImageSelection = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("ingressGateways"u8)) + if (property.NameEquals("status"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(IstioIngressGateway.DeserializeIstioIngressGateway(item, options)); - } - ingressGateways = array; + status = UpdateStatus.DeserializeUpdateStatus(property.Value, options); continue; } - if (property.NameEquals("egressGateways"u8)) + if (property.NameEquals("stages"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(IstioEgressGateway.DeserializeIstioEgressGateway(item, options)); + array.Add(UpdateStageStatus.DeserializeUpdateStageStatus(item, options)); + } + stages = array; + continue; + } + if (property.NameEquals("nodeImageSelection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; } - egressGateways = array; + nodeImageSelection = NodeImageSelectionStatus.DeserializeNodeImageSelectionStatus(property.Value, options); continue; } if (options.Format != "W") @@ -133,7 +138,7 @@ internal static IstioComponents DeserializeIstioComponents(JsonElement element, } } serializedAdditionalRawData = rawDataDictionary; - return new IstioComponents(ingressGateways ?? new ChangeTrackingList(), egressGateways ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UpdateRunStatus(status, stages ?? new ChangeTrackingList(), nodeImageSelection, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -147,59 +152,69 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IngressGateways), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" ingressGateways: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(IngressGateways)) + if (Optional.IsDefined(Status)) { - if (IngressGateways.Any()) - { - builder.Append(" ingressGateways: "); - builder.AppendLine("["); - foreach (var item in IngressGateways) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " ingressGateways: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EgressGateways), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Stages), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" egressGateways: "); + builder.Append(" stages: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(EgressGateways)) + if (Optional.IsCollectionDefined(Stages)) { - if (EgressGateways.Any()) + if (Stages.Any()) { - builder.Append(" egressGateways: "); + builder.Append(" stages: "); builder.AppendLine("["); - foreach (var item in EgressGateways) + foreach (var item in Stages) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " egressGateways: "); + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " stages: "); } builder.AppendLine(" ]"); } } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("SelectedNodeImageVersions", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nodeImageSelection: "); + builder.AppendLine("{"); + builder.Append(" selectedNodeImageVersions: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(NodeImageSelection)) + { + builder.Append(" nodeImageSelection: "); + BicepSerializationHelpers.AppendChildObject(builder, NodeImageSelection, options, 2, false, " nodeImageSelection: "); + } + } + 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) { @@ -208,26 +223,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOptions opt case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(IstioComponents)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStatus)} does not support writing '{options.Format}' format."); } } - IstioComponents IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateRunStatus 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); - return DeserializeIstioComponents(document.RootElement, options); + return DeserializeUpdateRunStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(IstioComponents)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStatus)} 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/UpdateRunStatus.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.cs new file mode 100644 index 000000000000..798359988e31 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStatus.cs @@ -0,0 +1,82 @@ +// 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 status of a UpdateRun. + public partial class UpdateRunStatus + { + /// + /// 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 UpdateRunStatus() + { + Stages = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The status of the UpdateRun. + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + /// Keeps track of any properties unknown to the library. + internal UpdateRunStatus(UpdateStatus status, IReadOnlyList stages, NodeImageSelectionStatus nodeImageSelection, IDictionary serializedAdditionalRawData) + { + Status = status; + Stages = stages; + NodeImageSelection = nodeImageSelection; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the UpdateRun. + [WirePath("status")] + public UpdateStatus Status { get; } + /// The stages composing an update run. Stages are run sequentially withing an UpdateRun. + [WirePath("stages")] + public IReadOnlyList Stages { get; } + /// The node image upgrade specs for the update run. It is only set in update run when `NodeImageSelection.type` is `Consistent`. + internal NodeImageSelectionStatus NodeImageSelection { get; } + /// The image versions to upgrade the nodes to. + [WirePath("nodeImageSelection.selectedNodeImageVersions")] + public IReadOnlyList SelectedNodeImageVersions + { + get => NodeImageSelection?.SelectedNodeImageVersions; + } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.Serialization.cs similarity index 60% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.Serialization.cs index 699d7768cb99..65825b90b5ba 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshConfiguration.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceSshConfiguration : IUtf8JsonSerializable, IJsonModel + internal partial class UpdateRunStrategy : 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); @@ -30,15 +30,15 @@ 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(ContainerServiceSshConfiguration)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStrategy)} does not support writing '{format}' format."); } - writer.WritePropertyName("publicKeys"u8); + writer.WritePropertyName("stages"u8); writer.WriteStartArray(); - foreach (var item in PublicKeys) + foreach (var item in Stages) { writer.WriteObjectValue(item, options); } @@ -60,19 +60,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceSshConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateRunStrategy 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(ContainerServiceSshConfiguration)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStrategy)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceSshConfiguration(document.RootElement, options); + return DeserializeUpdateRunStrategy(document.RootElement, options); } - internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateRunStrategy DeserializeUpdateRunStrategy(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,19 +80,19 @@ internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshC { return null; } - IList publicKeys = default; + IList stages = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("publicKeys"u8)) + if (property.NameEquals("stages"u8)) { - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ContainerServiceSshPublicKey.DeserializeContainerServiceSshPublicKey(item, options)); + array.Add(UpdateStage.DeserializeUpdateStage(item, options)); } - publicKeys = array; + stages = array; continue; } if (options.Format != "W") @@ -101,7 +101,7 @@ internal static ContainerServiceSshConfiguration DeserializeContainerServiceSshC } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceSshConfiguration(publicKeys, serializedAdditionalRawData); + return new UpdateRunStrategy(stages, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -115,23 +115,23 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicKeys), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Stages), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" publicKeys: "); + builder.Append(" stages: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(PublicKeys)) + if (Optional.IsCollectionDefined(Stages)) { - if (PublicKeys.Any()) + if (Stages.Any()) { - builder.Append(" publicKeys: "); + builder.Append(" stages: "); builder.AppendLine("["); - foreach (var item in PublicKeys) + foreach (var item in Stages) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " publicKeys: "); + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " stages: "); } builder.AppendLine(" ]"); } @@ -142,9 +142,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -153,26 +153,26 @@ BinaryData IPersistableModel.Write(ModelReader case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceSshConfiguration)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStrategy)} does not support writing '{options.Format}' format."); } } - ContainerServiceSshConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateRunStrategy 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); - return DeserializeContainerServiceSshConfiguration(document.RootElement, options); + return DeserializeUpdateRunStrategy(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceSshConfiguration)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunStrategy)} 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/ContainerServiceSshPublicKey.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.cs similarity index 57% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.cs index 58805719cc58..7effd43151d9 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceSshPublicKey.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateRunStrategy.cs @@ -7,11 +7,20 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.ContainerService.Models { - /// Contains information about SSH certificate public key data. - public partial class ContainerServiceSshPublicKey + /// + /// Defines the update sequence of the clusters via stages and groups. + /// + /// Stages within a run are executed sequentially one after another. + /// Groups within a stage are executed in parallel. + /// Member clusters within a group are updated sequentially one after another. + /// + /// A valid strategy contains no duplicate groups within or across stages. + /// + internal partial class UpdateRunStrategy { /// /// Keeps track of any properties unknown to the library. @@ -45,32 +54,32 @@ public partial class ContainerServiceSshPublicKey /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. - /// is null. - public ContainerServiceSshPublicKey(string keyData) + /// Initializes a new instance of . + /// The list of stages that compose this update run. Min size: 1. + /// is null. + public UpdateRunStrategy(IEnumerable stages) { - Argument.AssertNotNull(keyData, nameof(keyData)); + Argument.AssertNotNull(stages, nameof(stages)); - KeyData = keyData; + Stages = stages.ToList(); } - /// Initializes a new instance of . - /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. + /// Initializes a new instance of . + /// The list of stages that compose this update run. Min size: 1. /// Keeps track of any properties unknown to the library. - internal ContainerServiceSshPublicKey(string keyData, IDictionary serializedAdditionalRawData) + internal UpdateRunStrategy(IList stages, IDictionary serializedAdditionalRawData) { - KeyData = keyData; + Stages = stages; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal ContainerServiceSshPublicKey() + /// Initializes a new instance of for deserialization. + internal UpdateRunStrategy() { } - /// Certificate public key used to authenticate with VMs through SSH. The certificate must be in PEM format with or without headers. - [WirePath("keyData")] - public string KeyData { get; set; } + /// The list of stages that compose this update run. Min size: 1. + [WirePath("stages")] + public IList Stages { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.Serialization.cs similarity index 57% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.Serialization.cs index 64c3ab232297..d114b488a762 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceOutboundEnvironmentEndpoint.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceOutboundEnvironmentEndpoint : IUtf8JsonSerializable, IJsonModel + public partial class UpdateStage : 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); @@ -30,27 +30,29 @@ void IJsonModel.Write(Utf8JsonWrite /// 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(ContainerServiceOutboundEnvironmentEndpoint)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStage)} does not support writing '{format}' format."); } - if (Optional.IsDefined(Category)) + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsCollectionDefined(Groups)) { - writer.WritePropertyName("category"u8); - writer.WriteStringValue(Category); - } - if (Optional.IsCollectionDefined(Endpoints)) - { - writer.WritePropertyName("endpoints"u8); + writer.WritePropertyName("groups"u8); writer.WriteStartArray(); - foreach (var item in Endpoints) + foreach (var item in Groups) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } + if (Optional.IsDefined(AfterStageWaitInSeconds)) + { + writer.WritePropertyName("afterStageWaitInSeconds"u8); + writer.WriteNumberValue(AfterStageWaitInSeconds.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -68,19 +70,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceOutboundEnvironmentEndpoint IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateStage 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(ContainerServiceOutboundEnvironmentEndpoint)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStage)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceOutboundEnvironmentEndpoint(document.RootElement, options); + return DeserializeUpdateStage(document.RootElement, options); } - internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainerServiceOutboundEnvironmentEndpoint(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateStage DeserializeUpdateStage(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -88,29 +90,39 @@ internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainer { return null; } - string category = default; - IReadOnlyList endpoints = default; + string name = default; + IList groups = default; + int? afterStageWaitInSeconds = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("category"u8)) + if (property.NameEquals("name"u8)) { - category = property.Value.GetString(); + name = property.Value.GetString(); continue; } - if (property.NameEquals("endpoints"u8)) + if (property.NameEquals("groups"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ContainerServiceEndpointDependency.DeserializeContainerServiceEndpointDependency(item, options)); + array.Add(UpdateGroup.DeserializeUpdateGroup(item, options)); + } + groups = array; + continue; + } + if (property.NameEquals("afterStageWaitInSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; } - endpoints = array; + afterStageWaitInSeconds = property.Value.GetInt32(); continue; } if (options.Format != "W") @@ -119,7 +131,7 @@ internal static ContainerServiceOutboundEnvironmentEndpoint DeserializeContainer } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceOutboundEnvironmentEndpoint(category, endpoints ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UpdateStage(name, groups ?? new ChangeTrackingList(), afterStageWaitInSeconds, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -133,59 +145,74 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Category), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" category: "); + builder.Append(" name: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Category)) + if (Optional.IsDefined(Name)) { - builder.Append(" category: "); - if (Category.Contains(Environment.NewLine)) + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{Category}'''"); + builder.AppendLine($"{Name}'''"); } else { - builder.AppendLine($"'{Category}'"); + builder.AppendLine($"'{Name}'"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Endpoints), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Groups), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" endpoints: "); + builder.Append(" groups: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(Endpoints)) + if (Optional.IsCollectionDefined(Groups)) { - if (Endpoints.Any()) + if (Groups.Any()) { - builder.Append(" endpoints: "); + builder.Append(" groups: "); builder.AppendLine("["); - foreach (var item in Endpoints) + foreach (var item in Groups) { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " endpoints: "); + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " groups: "); } builder.AppendLine(" ]"); } } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AfterStageWaitInSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" afterStageWaitInSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AfterStageWaitInSeconds)) + { + builder.Append(" afterStageWaitInSeconds: "); + builder.AppendLine($"{AfterStageWaitInSeconds.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) { @@ -194,26 +221,26 @@ BinaryData IPersistableModel.Write( case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceOutboundEnvironmentEndpoint)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStage)} does not support writing '{options.Format}' format."); } } - ContainerServiceOutboundEnvironmentEndpoint IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateStage 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); - return DeserializeContainerServiceOutboundEnvironmentEndpoint(document.RootElement, options); + return DeserializeUpdateStage(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceOutboundEnvironmentEndpoint)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStage)} 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/UpdateStage.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.cs new file mode 100644 index 000000000000..5cc61da063fc --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStage.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; + +namespace Azure.ResourceManager.ContainerService.Models +{ + /// Defines a stage which contains the groups to update and the steps to take (e.g., wait for a time period) before starting the next stage. + public partial class UpdateStage + { + /// + /// 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 name of the stage. Must be unique within the UpdateRun. + /// is null. + public UpdateStage(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + Groups = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The name of the stage. Must be unique within the UpdateRun. + /// Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. + /// The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. + /// Keeps track of any properties unknown to the library. + internal UpdateStage(string name, IList groups, int? afterStageWaitInSeconds, IDictionary serializedAdditionalRawData) + { + Name = name; + Groups = groups; + AfterStageWaitInSeconds = afterStageWaitInSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UpdateStage() + { + } + + /// The name of the stage. Must be unique within the UpdateRun. + [WirePath("name")] + public string Name { get; set; } + /// Defines the groups to be executed in parallel in this stage. Duplicate groups are not allowed. Min size: 1. + [WirePath("groups")] + public IList Groups { get; } + /// The time in seconds to wait at the end of this stage before starting the next one. Defaults to 0 seconds if unspecified. + [WirePath("afterStageWaitInSeconds")] + public int? AfterStageWaitInSeconds { 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/UpdateStageStatus.Serialization.cs similarity index 59% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStageStatus.Serialization.cs index cadaa568e9d6..47dc531182ee 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ManagedClusterPoolUpgradeProfile.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStageStatus.Serialization.cs @@ -15,11 +15,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ManagedClusterPoolUpgradeProfile : IUtf8JsonSerializable, IJsonModel + public partial class UpdateStageStatus : 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); @@ -30,31 +30,37 @@ 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(ManagedClusterPoolUpgradeProfile)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStageStatus)} does not support writing '{format}' format."); } - writer.WritePropertyName("kubernetesVersion"u8); - writer.WriteStringValue(KubernetesVersion); - if (Optional.IsDefined(Name)) + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (options.Format != "W" && Optional.IsDefined(Name)) { writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); } - writer.WritePropertyName("osType"u8); - writer.WriteStringValue(OSType.ToString()); - if (Optional.IsCollectionDefined(Upgrades)) + if (options.Format != "W" && Optional.IsCollectionDefined(Groups)) { - writer.WritePropertyName("upgrades"u8); + writer.WritePropertyName("groups"u8); writer.WriteStartArray(); - foreach (var item in Upgrades) + foreach (var item in Groups) { writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } + if (options.Format != "W" && Optional.IsDefined(AfterStageWaitStatus)) + { + writer.WritePropertyName("afterStageWaitStatus"u8); + writer.WriteObjectValue(AfterStageWaitStatus, options); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -72,19 +78,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ManagedClusterPoolUpgradeProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateStageStatus 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(ManagedClusterPoolUpgradeProfile)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStageStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeManagedClusterPoolUpgradeProfile(document.RootElement, options); + return DeserializeUpdateStageStatus(document.RootElement, options); } - internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUpgradeProfile(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateStageStatus DeserializeUpdateStageStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -92,17 +98,21 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp { return null; } - string kubernetesVersion = default; + UpdateStatus status = default; string name = default; - ContainerServiceOSType osType = default; - IReadOnlyList upgrades = default; + IReadOnlyList groups = default; + WaitStatus afterStageWaitStatus = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kubernetesVersion"u8)) + if (property.NameEquals("status"u8)) { - kubernetesVersion = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = UpdateStatus.DeserializeUpdateStatus(property.Value, options); continue; } if (property.NameEquals("name"u8)) @@ -110,23 +120,27 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp name = property.Value.GetString(); continue; } - if (property.NameEquals("osType"u8)) - { - osType = new ContainerServiceOSType(property.Value.GetString()); - continue; - } - if (property.NameEquals("upgrades"u8)) + if (property.NameEquals("groups"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ManagedClusterPoolUpgradeProfileUpgradesItem.DeserializeManagedClusterPoolUpgradeProfileUpgradesItem(item, options)); + array.Add(UpdateGroupStatus.DeserializeUpdateGroupStatus(item, options)); } - upgrades = array; + groups = array; + continue; + } + if (property.NameEquals("afterStageWaitStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + afterStageWaitStatus = WaitStatus.DeserializeWaitStatus(property.Value, options); continue; } if (options.Format != "W") @@ -135,7 +149,7 @@ internal static ManagedClusterPoolUpgradeProfile DeserializeManagedClusterPoolUp } } serializedAdditionalRawData = rawDataDictionary; - return new ManagedClusterPoolUpgradeProfile(kubernetesVersion, name, osType, upgrades ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new UpdateStageStatus(status, name, groups ?? new ChangeTrackingList(), afterStageWaitStatus, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -149,26 +163,18 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubernetesVersion), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" kubernetesVersion: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(KubernetesVersion)) + if (Optional.IsDefined(Status)) { - builder.Append(" kubernetesVersion: "); - if (KubernetesVersion.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{KubernetesVersion}'''"); - } - else - { - builder.AppendLine($"'{KubernetesVersion}'"); - } + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); } } @@ -195,38 +201,41 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OSType), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Groups), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" osType: "); + builder.Append(" groups: "); builder.AppendLine(propertyOverride); } else { - builder.Append(" osType: "); - builder.AppendLine($"'{OSType.ToString()}'"); + if (Optional.IsCollectionDefined(Groups)) + { + if (Groups.Any()) + { + builder.Append(" groups: "); + builder.AppendLine("["); + foreach (var item in Groups) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " groups: "); + } + builder.AppendLine(" ]"); + } + } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Upgrades), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AfterStageWaitStatus), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" upgrades: "); + builder.Append(" afterStageWaitStatus: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsCollectionDefined(Upgrades)) + if (Optional.IsDefined(AfterStageWaitStatus)) { - if (Upgrades.Any()) - { - builder.Append(" upgrades: "); - builder.AppendLine("["); - foreach (var item in Upgrades) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " upgrades: "); - } - builder.AppendLine(" ]"); - } + builder.Append(" afterStageWaitStatus: "); + BicepSerializationHelpers.AppendChildObject(builder, AfterStageWaitStatus, options, 2, false, " afterStageWaitStatus: "); } } @@ -234,9 +243,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -245,26 +254,26 @@ BinaryData IPersistableModel.Write(ModelReader case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ManagedClusterPoolUpgradeProfile)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStageStatus)} does not support writing '{options.Format}' format."); } } - ManagedClusterPoolUpgradeProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateStageStatus 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); - return DeserializeManagedClusterPoolUpgradeProfile(document.RootElement, options); + return DeserializeUpdateStageStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ManagedClusterPoolUpgradeProfile)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStageStatus)} 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/UpgradeOverrideSettings.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStageStatus.cs similarity index 53% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeOverrideSettings.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStageStatus.cs index 69fc20e5bd60..a75a4e90ea80 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeOverrideSettings.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStageStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Settings for overrides when upgrading a cluster. - public partial class UpgradeOverrideSettings + /// The status of a UpdateStage. + public partial class UpdateStageStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,38 @@ public partial class UpgradeOverrideSettings /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public UpgradeOverrideSettings() + /// Initializes a new instance of . + internal UpdateStageStatus() { + Groups = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// Whether to force upgrade the cluster. Note that this option instructs upgrade operation to bypass upgrade protections such as checking for deprecated API usage. Enable this option only with caution. - /// Until when the overrides are effective. Note that this only matches the start time of an upgrade, and the effectiveness won't change once an upgrade starts even if the `until` expires as upgrade proceeds. This field is not set by default. It must be set for the overrides to take effect. + /// Initializes a new instance of . + /// The status of the UpdateStage. + /// The name of the UpdateStage. + /// The list of groups to be updated as part of this UpdateStage. + /// The status of the wait period configured on the UpdateStage. /// Keeps track of any properties unknown to the library. - internal UpgradeOverrideSettings(bool? forceUpgrade, DateTimeOffset? until, IDictionary serializedAdditionalRawData) + internal UpdateStageStatus(UpdateStatus status, string name, IReadOnlyList groups, WaitStatus afterStageWaitStatus, IDictionary serializedAdditionalRawData) { - ForceUpgrade = forceUpgrade; - Until = until; + Status = status; + Name = name; + Groups = groups; + AfterStageWaitStatus = afterStageWaitStatus; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Whether to force upgrade the cluster. Note that this option instructs upgrade operation to bypass upgrade protections such as checking for deprecated API usage. Enable this option only with caution. - [WirePath("forceUpgrade")] - public bool? ForceUpgrade { get; set; } - /// Until when the overrides are effective. Note that this only matches the start time of an upgrade, and the effectiveness won't change once an upgrade starts even if the `until` expires as upgrade proceeds. This field is not set by default. It must be set for the overrides to take effect. - [WirePath("until")] - public DateTimeOffset? Until { get; set; } + /// The status of the UpdateStage. + [WirePath("status")] + public UpdateStatus Status { get; } + /// The name of the UpdateStage. + [WirePath("name")] + public string Name { get; } + /// The list of groups to be updated as part of this UpdateStage. + [WirePath("groups")] + public IReadOnlyList Groups { get; } + /// The status of the wait period configured on the UpdateStage. + [WirePath("afterStageWaitStatus")] + public WaitStatus AfterStageWaitStatus { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateState.cs new file mode 100644 index 000000000000..2190343ed98d --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateState.cs @@ -0,0 +1,66 @@ +// 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 state of the UpdateRun, UpdateStage, UpdateGroup, or MemberUpdate. + public readonly partial struct UpdateState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public UpdateState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string StoppingValue = "Stopping"; + private const string StoppedValue = "Stopped"; + private const string SkippedValue = "Skipped"; + private const string FailedValue = "Failed"; + private const string CompletedValue = "Completed"; + + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has not been started. + public static UpdateState NotStarted { get; } = new UpdateState(NotStartedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is running. + public static UpdateState Running { get; } = new UpdateState(RunningValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that is being stopped. + public static UpdateState Stopping { get; } = new UpdateState(StoppingValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has stopped. + public static UpdateState Stopped { get; } = new UpdateState(StoppedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has been skipped. + public static UpdateState Skipped { get; } = new UpdateState(SkippedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has failed. + public static UpdateState Failed { get; } = new UpdateState(FailedValue); + /// The state of an UpdateRun/UpdateStage/UpdateGroup/MemberUpdate that has completed. + public static UpdateState Completed { get; } = new UpdateState(CompletedValue); + /// Determines if two values are the same. + public static bool operator ==(UpdateState left, UpdateState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(UpdateState left, UpdateState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator UpdateState(string value) => new UpdateState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is UpdateState other && Equals(other); + /// + public bool Equals(UpdateState 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/ContainerServiceEndpointDetail.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.Serialization.cs similarity index 53% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.Serialization.cs index a4f62b7947cf..ba45fb734668 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceEndpointDetail.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.Serialization.cs @@ -8,18 +8,17 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; -using System.Net; using System.Text; using System.Text.Json; using Azure.Core; namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceEndpointDetail : IUtf8JsonSerializable, IJsonModel + public partial class UpdateStatus : 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); @@ -30,31 +29,31 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod /// 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(ContainerServiceEndpointDetail)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(IPAddress)) + if (options.Format != "W" && Optional.IsDefined(StartOn)) { - writer.WritePropertyName("ipAddress"u8); - writer.WriteStringValue(IPAddress.ToString()); + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); } - if (Optional.IsDefined(Port)) + if (options.Format != "W" && Optional.IsDefined(CompletedOn)) { - writer.WritePropertyName("port"u8); - writer.WriteNumberValue(Port.Value); + writer.WritePropertyName("completedTime"u8); + writer.WriteStringValue(CompletedOn.Value, "O"); } - if (Optional.IsDefined(Protocol)) + if (options.Format != "W" && Optional.IsDefined(State)) { - writer.WritePropertyName("protocol"u8); - writer.WriteStringValue(Protocol); + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); } - if (Optional.IsDefined(Description)) + if (options.Format != "W" && Optional.IsDefined(Error)) { - writer.WritePropertyName("description"u8); - writer.WriteStringValue(Description); + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -73,19 +72,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceEndpointDetail IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateStatus 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(ContainerServiceEndpointDetail)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceEndpointDetail(document.RootElement, options); + return DeserializeUpdateStatus(document.RootElement, options); } - internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpointDetail(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateStatus DeserializeUpdateStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -93,40 +92,48 @@ internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpoi { return null; } - IPAddress ipAddress = default; - int? port = default; - string protocol = default; - string description = default; + DateTimeOffset? startTime = default; + DateTimeOffset? completedTime = default; + UpdateState? state = default; + ResponseError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("ipAddress"u8)) + if (property.NameEquals("startTime"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - ipAddress = IPAddress.Parse(property.Value.GetString()); + startTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("port"u8)) + if (property.NameEquals("completedTime"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - port = property.Value.GetInt32(); + completedTime = property.Value.GetDateTimeOffset("O"); continue; } - if (property.NameEquals("protocol"u8)) + if (property.NameEquals("state"u8)) { - protocol = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new UpdateState(property.Value.GetString()); continue; } - if (property.NameEquals("description"u8)) + if (property.NameEquals("error"u8)) { - description = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); continue; } if (options.Format != "W") @@ -135,7 +142,7 @@ internal static ContainerServiceEndpointDetail DeserializeContainerServiceEndpoi } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceEndpointDetail(ipAddress, port, protocol, description, serializedAdditionalRawData); + return new UpdateStatus(startTime, completedTime, state, error, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -149,79 +156,65 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPAddress), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" ipAddress: "); + builder.Append(" startTime: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(IPAddress)) + if (Optional.IsDefined(StartOn)) { - builder.Append(" ipAddress: "); - builder.AppendLine($"'{IPAddress.ToString()}'"); + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Port), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CompletedOn), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" port: "); + builder.Append(" completedTime: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Port)) + if (Optional.IsDefined(CompletedOn)) { - builder.Append(" port: "); - builder.AppendLine($"{Port.Value}"); + builder.Append(" completedTime: "); + var formattedDateTimeString = TypeFormatters.ToString(CompletedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Protocol), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(State), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" protocol: "); + builder.Append(" state: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Protocol)) + if (Optional.IsDefined(State)) { - builder.Append(" protocol: "); - if (Protocol.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Protocol}'''"); - } - else - { - builder.AppendLine($"'{Protocol}'"); - } + builder.Append(" state: "); + builder.AppendLine($"'{State.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Description), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" description: "); + builder.Append(" error: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(Description)) + if (Optional.IsDefined(Error)) { - builder.Append(" description: "); - if (Description.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Description}'''"); - } - else - { - builder.AppendLine($"'{Description}'"); - } + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); } } @@ -229,9 +222,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -240,26 +233,26 @@ BinaryData IPersistableModel.Write(ModelReaderWr case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceEndpointDetail)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStatus)} does not support writing '{options.Format}' format."); } } - ContainerServiceEndpointDetail IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateStatus 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); - return DeserializeContainerServiceEndpointDetail(document.RootElement, options); + return DeserializeUpdateStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceEndpointDetail)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateStatus)} 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/ContainerServiceTimeSpan.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.cs similarity index 54% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.cs index 81da86fa5927..0eff6ea457e2 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpdateStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// For example, between 2021-05-25T13:00:00Z and 2021-05-25T14:00:00Z. - public partial class ContainerServiceTimeSpan + /// The status for an operation or group of operations. + public partial class UpdateStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,27 +45,37 @@ public partial class ContainerServiceTimeSpan /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ContainerServiceTimeSpan() + /// Initializes a new instance of . + internal UpdateStatus() { } - /// Initializes a new instance of . - /// The start of a time span. - /// The end of a time span. + /// Initializes a new instance of . + /// The time the operation or group was started. + /// The time the operation or group was completed. + /// The State of the operation or group. + /// The error details when a failure is encountered. /// Keeps track of any properties unknown to the library. - internal ContainerServiceTimeSpan(DateTimeOffset? startOn, DateTimeOffset? endOn, IDictionary serializedAdditionalRawData) + internal UpdateStatus(DateTimeOffset? startOn, DateTimeOffset? completedOn, UpdateState? state, ResponseError error, IDictionary serializedAdditionalRawData) { StartOn = startOn; - EndOn = endOn; + CompletedOn = completedOn; + State = state; + Error = error; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The start of a time span. - [WirePath("start")] - public DateTimeOffset? StartOn { get; set; } - /// The end of a time span. - [WirePath("end")] - public DateTimeOffset? EndOn { get; set; } + /// The time the operation or group was started. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; } + /// The time the operation or group was completed. + [WirePath("completedTime")] + public DateTimeOffset? CompletedOn { get; } + /// The State of the operation or group. + [WirePath("state")] + public UpdateState? State { get; } + /// The error details when a failure is encountered. + [WirePath("error")] + public ResponseError Error { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeChannel.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeChannel.cs index bc3748efc9e9..8f1a6e7fe045 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeChannel.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/UpgradeChannel.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// For more information see [setting the AKS cluster auto-upgrade channel](https://docs.microsoft.com/azure/aks/upgrade-cluster#set-auto-upgrade-channel). + /// Configuration of how auto upgrade will be run. public readonly partial struct UpgradeChannel : IEquatable { private readonly string _value; @@ -22,22 +22,19 @@ public UpgradeChannel(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string RapidValue = "rapid"; - private const string StableValue = "stable"; - private const string PatchValue = "patch"; - private const string NodeImageValue = "node-image"; - private const string NoneValue = "none"; + private const string StableValue = "Stable"; + private const string RapidValue = "Rapid"; + private const string NodeImageValue = "NodeImage"; - /// Automatically upgrade the cluster to the latest supported patch release on the latest supported minor version. In cases where the cluster is at a version of Kubernetes that is at an N-2 minor version where N is the latest supported minor version, the cluster first upgrades to the latest supported patch version on N-1 minor version. For example, if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster first is upgraded to 1.18.6, then is upgraded to 1.19.1. - public static UpgradeChannel Rapid { get; } = new UpgradeChannel(RapidValue); - /// Automatically upgrade the cluster to the latest supported patch release on minor version N-1, where N is the latest supported minor version. For example, if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to 1.18.6. + /// + /// Upgrades the clusters kubernetes version to the latest supported patch release on minor version N-1, where N is the latest supported minor version. + /// For example, if a cluster runs version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, the cluster upgrades to 1.18.6. + /// public static UpgradeChannel Stable { get; } = new UpgradeChannel(StableValue); - /// Automatically upgrade the cluster to the latest supported patch version when it becomes available while keeping the minor version the same. For example, if a cluster is running version 1.17.7 and versions 1.17.9, 1.18.4, 1.18.6, and 1.19.1 are available, your cluster is upgraded to 1.17.9. - public static UpgradeChannel Patch { get; } = new UpgradeChannel(PatchValue); - /// Automatically upgrade the node image to the latest version available. Consider using nodeOSUpgradeChannel instead as that allows you to configure node OS patching separate from Kubernetes version patching. + /// Upgrades the clusters kubernetes version to the latest supported patch release on the latest supported minor version. + public static UpgradeChannel Rapid { get; } = new UpgradeChannel(RapidValue); + /// Upgrade node image version of the clusters. public static UpgradeChannel NodeImage { get; } = new UpgradeChannel(NodeImageValue); - /// Disables auto-upgrades and keeps the cluster at its current version of Kubernetes. - public static UpgradeChannel None { get; } = new UpgradeChannel(NoneValue); /// Determines if two values are the same. public static bool operator ==(UpgradeChannel left, UpgradeChannel right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.Serialization.cs similarity index 59% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.Serialization.cs index 0417e9942284..86e678f233c0 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServiceTimeSpan.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.Serialization.cs @@ -14,11 +14,11 @@ namespace Azure.ResourceManager.ContainerService.Models { - public partial class ContainerServiceTimeSpan : IUtf8JsonSerializable, IJsonModel + public partial class WaitStatus : 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,21 +29,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead /// 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(ContainerServiceTimeSpan)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(WaitStatus)} does not support writing '{format}' format."); } - if (Optional.IsDefined(StartOn)) + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WritePropertyName("start"u8); - writer.WriteStringValue(StartOn.Value, "O"); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } - if (Optional.IsDefined(EndOn)) + if (options.Format != "W" && Optional.IsDefined(WaitDurationInSeconds)) { - writer.WritePropertyName("end"u8); - writer.WriteStringValue(EndOn.Value, "O"); + writer.WritePropertyName("waitDurationInSeconds"u8); + writer.WriteNumberValue(WaitDurationInSeconds.Value); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -62,19 +62,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - ContainerServiceTimeSpan IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + WaitStatus 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(ContainerServiceTimeSpan)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(WaitStatus)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTimeSpan(document.RootElement, options); + return DeserializeWaitStatus(document.RootElement, options); } - internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(JsonElement element, ModelReaderWriterOptions options = null) + internal static WaitStatus DeserializeWaitStatus(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -82,28 +82,28 @@ internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(Jso { return null; } - DateTimeOffset? start = default; - DateTimeOffset? end = default; + UpdateStatus status = default; + int? waitDurationInSeconds = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("start"u8)) + if (property.NameEquals("status"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - start = property.Value.GetDateTimeOffset("O"); + status = UpdateStatus.DeserializeUpdateStatus(property.Value, options); continue; } - if (property.NameEquals("end"u8)) + if (property.NameEquals("waitDurationInSeconds"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - end = property.Value.GetDateTimeOffset("O"); + waitDurationInSeconds = property.Value.GetInt32(); continue; } if (options.Format != "W") @@ -112,7 +112,7 @@ internal static ContainerServiceTimeSpan DeserializeContainerServiceTimeSpan(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTimeSpan(start, end, serializedAdditionalRawData); + return new WaitStatus(status, waitDurationInSeconds, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -126,35 +126,33 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" start: "); + builder.Append(" status: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(StartOn)) + if (Optional.IsDefined(Status)) { - builder.Append(" start: "); - var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 2, false, " status: "); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WaitDurationInSeconds), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" end: "); + builder.Append(" waitDurationInSeconds: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(EndOn)) + if (Optional.IsDefined(WaitDurationInSeconds)) { - builder.Append(" end: "); - var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); - builder.AppendLine($"'{formattedDateTimeString}'"); + builder.Append(" waitDurationInSeconds: "); + builder.AppendLine($"{WaitDurationInSeconds.Value}"); } } @@ -162,9 +160,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -173,26 +171,26 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceTimeSpan)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(WaitStatus)} does not support writing '{options.Format}' format."); } } - ContainerServiceTimeSpan IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + WaitStatus 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); - return DeserializeContainerServiceTimeSpan(document.RootElement, options); + return DeserializeWaitStatus(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceTimeSpan)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(WaitStatus)} 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/ContainerServicePowerState.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.cs similarity index 65% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.cs index fc2f15793a2a..8daf0a2b5457 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/ContainerServicePowerState.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WaitStatus.cs @@ -10,8 +10,8 @@ namespace Azure.ResourceManager.ContainerService.Models { - /// Describes the Power State of the cluster. - internal partial class ContainerServicePowerState + /// The status of the wait duration. + public partial class WaitStatus { /// /// Keeps track of any properties unknown to the library. @@ -45,22 +45,27 @@ internal partial class ContainerServicePowerState /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public ContainerServicePowerState() + /// Initializes a new instance of . + internal WaitStatus() { } - /// Initializes a new instance of . - /// Tells whether the cluster is Running or Stopped. + /// Initializes a new instance of . + /// The status of the wait duration. + /// The wait duration configured in seconds. /// Keeps track of any properties unknown to the library. - internal ContainerServicePowerState(ContainerServiceStateCode? code, IDictionary serializedAdditionalRawData) + internal WaitStatus(UpdateStatus status, int? waitDurationInSeconds, IDictionary serializedAdditionalRawData) { - Code = code; + Status = status; + WaitDurationInSeconds = waitDurationInSeconds; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Tells whether the cluster is Running or Stopped. - [WirePath("code")] - public ContainerServiceStateCode? Code { get; set; } + /// The status of the wait duration. + [WirePath("status")] + public UpdateStatus Status { get; } + /// The wait duration configured in seconds. + [WirePath("waitDurationInSeconds")] + public int? WaitDurationInSeconds { get; } } } diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs deleted file mode 100644 index 948a1af73081..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.Serialization.cs +++ /dev/null @@ -1,235 +0,0 @@ -// 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 WindowsGmsaProfile : 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(WindowsGmsaProfile)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(IsEnabled)) - { - writer.WritePropertyName("enabled"u8); - writer.WriteBooleanValue(IsEnabled.Value); - } - if (Optional.IsDefined(DnsServer)) - { - writer.WritePropertyName("dnsServer"u8); - writer.WriteStringValue(DnsServer); - } - if (Optional.IsDefined(RootDomainName)) - { - writer.WritePropertyName("rootDomainName"u8); - writer.WriteStringValue(RootDomainName); - } - 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)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - WindowsGmsaProfile 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(WindowsGmsaProfile)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeWindowsGmsaProfile(document.RootElement, options); - } - - internal static WindowsGmsaProfile DeserializeWindowsGmsaProfile(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - bool? enabled = default; - string dnsServer = default; - string rootDomainName = 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("dnsServer"u8)) - { - dnsServer = property.Value.GetString(); - continue; - } - if (property.NameEquals("rootDomainName"u8)) - { - rootDomainName = property.Value.GetString(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new WindowsGmsaProfile(enabled, dnsServer, rootDomainName, 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(IsEnabled), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" enabled: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(IsEnabled)) - { - builder.Append(" enabled: "); - var boolValue = IsEnabled.Value == true ? "true" : "false"; - builder.AppendLine($"{boolValue}"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsServer), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" dnsServer: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(DnsServer)) - { - builder.Append(" dnsServer: "); - if (DnsServer.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{DnsServer}'''"); - } - else - { - builder.AppendLine($"'{DnsServer}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RootDomainName), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" rootDomainName: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(RootDomainName)) - { - builder.Append(" rootDomainName: "); - if (RootDomainName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{RootDomainName}'''"); - } - else - { - builder.AppendLine($"'{RootDomainName}'"); - } - } - } - - 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(WindowsGmsaProfile)} does not support writing '{options.Format}' format."); - } - } - - WindowsGmsaProfile 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); - return DeserializeWindowsGmsaProfile(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(WindowsGmsaProfile)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs deleted file mode 100644 index 1242e476d078..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsGmsaProfile.cs +++ /dev/null @@ -1,76 +0,0 @@ -// 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 -{ - /// Windows gMSA Profile in the managed cluster. - public partial class WindowsGmsaProfile - { - /// - /// 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 WindowsGmsaProfile() - { - } - - /// Initializes a new instance of . - /// Specifies whether to enable Windows gMSA in the managed cluster. - /// Specifies the DNS server for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - /// Specifies the root domain name for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - /// Keeps track of any properties unknown to the library. - internal WindowsGmsaProfile(bool? isEnabled, string dnsServer, string rootDomainName, IDictionary serializedAdditionalRawData) - { - IsEnabled = isEnabled; - DnsServer = dnsServer; - RootDomainName = rootDomainName; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Specifies whether to enable Windows gMSA in the managed cluster. - [WirePath("enabled")] - public bool? IsEnabled { get; set; } - /// Specifies the DNS server for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - [WirePath("dnsServer")] - public string DnsServer { get; set; } - /// Specifies the root domain name for Windows gMSA. <br><br> Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. - [WirePath("rootDomainName")] - public string RootDomainName { get; set; } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsVmLicenseType.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsVmLicenseType.cs deleted file mode 100644 index 28e0a1bb149a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WindowsVmLicenseType.cs +++ /dev/null @@ -1,51 +0,0 @@ -// 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 license type to use for Windows VMs. See [Azure Hybrid User Benefits](https://azure.microsoft.com/pricing/hybrid-benefit/faq/) for more details. - public readonly partial struct WindowsVmLicenseType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public WindowsVmLicenseType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NoneValue = "None"; - private const string WindowsServerValue = "Windows_Server"; - - /// No additional licensing is applied. - public static WindowsVmLicenseType None { get; } = new WindowsVmLicenseType(NoneValue); - /// Enables Azure Hybrid User Benefits for Windows VMs. - public static WindowsVmLicenseType WindowsServer { get; } = new WindowsVmLicenseType(WindowsServerValue); - /// Determines if two values are the same. - public static bool operator ==(WindowsVmLicenseType left, WindowsVmLicenseType right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(WindowsVmLicenseType left, WindowsVmLicenseType right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WindowsVmLicenseType(string value) => new WindowsVmLicenseType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WindowsVmLicenseType other && Equals(other); - /// - public bool Equals(WindowsVmLicenseType 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/WorkloadRuntime.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs deleted file mode 100644 index 84e4f59e5f98..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/Models/WorkloadRuntime.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.ResourceManager.ContainerService.Models -{ - /// Determines the type of workload a node can run. - public readonly partial struct WorkloadRuntime : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public WorkloadRuntime(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string OciContainerValue = "OCIContainer"; - private const string WasmWasiValue = "WasmWasi"; - - /// 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); - /// 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. - public static bool operator !=(WorkloadRuntime left, WorkloadRuntime right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator WorkloadRuntime(string value) => new WorkloadRuntime(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is WorkloadRuntime other && Equals(other); - /// - public bool Equals(WorkloadRuntime 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/OSOptionProfileData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs deleted file mode 100644 index c2dc2b9eb88a..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.Serialization.cs +++ /dev/null @@ -1,271 +0,0 @@ -// 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 OSOptionProfileData : 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(OSOptionProfileData)} 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) - { - writer.WriteObjectValue(item, options); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - - OSOptionProfileData 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(OSOptionProfileData)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeOSOptionProfileData(document.RootElement, options); - } - - internal static OSOptionProfileData DeserializeOSOptionProfileData(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; - IReadOnlyList osOptionPropertyList = 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("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( - id, - name, - type, - systemData, - osOptionPropertyList, - 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(OSOptionPropertyList), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" osOptionPropertyList: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsCollectionDefined(OSOptionPropertyList)) - { - if (OSOptionPropertyList.Any()) - { - builder.Append(" osOptionPropertyList: "); - builder.AppendLine("["); - foreach (var item in OSOptionPropertyList) - { - BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " osOptionPropertyList: "); - } - builder.AppendLine(" ]"); - } - } - } - - 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(OSOptionProfileData)} does not support writing '{options.Format}' format."); - } - } - - OSOptionProfileData 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); - return DeserializeOSOptionProfileData(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(OSOptionProfileData)} 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/OSOptionProfileData.cs deleted file mode 100644 index 5fd0ccff4ad6..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileData.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Linq; -using Azure.Core; -using Azure.ResourceManager.ContainerService.Models; -using Azure.ResourceManager.Models; - -namespace Azure.ResourceManager.ContainerService -{ - /// - /// A class representing the OSOptionProfile data model. - /// The OS option profile. - /// - public partial class OSOptionProfileData : 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 . - /// The list of OS options. - /// is null. - internal OSOptionProfileData(IEnumerable osOptionPropertyList) - { - Argument.AssertNotNull(osOptionPropertyList, nameof(osOptionPropertyList)); - - OSOptionPropertyList = osOptionPropertyList.ToList(); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The list of OS options. - /// 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) - { - OSOptionPropertyList = osOptionPropertyList; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal OSOptionProfileData() - { - } - - /// The list of OS options. - [WirePath("properties.osOptionPropertyList")] - public IReadOnlyList OSOptionPropertyList { get; } - } -} 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/OSOptionProfileResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs deleted file mode 100644 index bd4c8e6a8bb9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/OSOptionProfileResource.cs +++ /dev/null @@ -1,172 +0,0 @@ -// 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 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. - /// - public partial class OSOptionProfileResource : ArmResource - { - /// Generate the resource identifier of a instance. - /// The subscriptionId. - /// The location. - public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, AzureLocation location) - { - var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default"; - return new ResourceIdentifier(resourceId); - } - - private readonly ClientDiagnostics _osOptionProfileManagedClustersClientDiagnostics; - private readonly ManagedClustersRestOperations _osOptionProfileManagedClustersRestClient; - private readonly OSOptionProfileData _data; - - /// Gets the resource type for the operations. - public static readonly ResourceType ResourceType = "Microsoft.ContainerService/locations/osOptions"; - - /// Initializes a new instance of the class for mocking. - protected OSOptionProfileResource() - { - } - - /// 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) - { - 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 OSOptionProfileResource(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); -#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 OSOptionProfileData 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 supported OS options in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default - /// - /// - /// Operation Id - /// ManagedClusters_GetOSOptions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) - { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); - scope.Start(); - try - { - var response = await _osOptionProfileManagedClustersRestClient.GetOSOptionsAsync(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken).ConfigureAwait(false); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Gets supported OS options in the specified subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.ContainerService/locations/{location}/osOptions/default - /// - /// - /// Operation Id - /// ManagedClusters_GetOSOptions - /// - /// - /// Default Api Version - /// 2023-10-01 - /// - /// - /// 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) - { - using var scope = _osOptionProfileManagedClustersClientDiagnostics.CreateScope("OSOptionProfileResource.Get"); - scope.Start(); - try - { - var response = _osOptionProfileManagedClustersRestClient.GetOSOptions(Id.SubscriptionId, new AzureLocation(Id.Parent.Name), resourceType, cancellationToken); - if (response.Value == null) - throw new RequestFailedException(response.GetRawResponse()); - return Response.FromValue(new OSOptionProfileResource(Client, response.Value), response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AutoUpgradeProfilesRestOperations.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AutoUpgradeProfilesRestOperations.cs index 2bde479507b1..a9d8cc22ef70 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AutoUpgradeProfilesRestOperations.cs @@ -15,28 +15,28 @@ namespace Azure.ResourceManager.ContainerService { - internal partial class MaintenanceConfigurationsRestOperations + internal partial class AutoUpgradeProfilesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of MaintenanceConfigurationsRestOperations. + /// Initializes a new instance of AutoUpgradeProfilesRestOperations. /// 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 MaintenanceConfigurationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public AutoUpgradeProfilesRestOperations(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 ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListByManagedClusterRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateListByFleetRequestUri(string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,14 +44,14 @@ internal RequestUriBuilder CreateListByManagedClusterRequestUri(string subscript 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("/maintenanceConfigurations", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByManagedClusterRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -62,9 +62,9 @@ internal HttpMessage CreateListByManagedClusterRequest(string subscriptionId, st 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("/maintenanceConfigurations", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,28 +72,28 @@ internal HttpMessage CreateListByManagedClusterRequest(string subscriptionId, st return message; } - /// Gets a list of maintenance configurations in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// List AutoUpgradeProfile resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationListResult value = default; + AutoUpgradeProfileListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceMaintenanceConfigurationListResult.DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement); + value = AutoUpgradeProfileListResult.DeserializeAutoUpgradeProfileListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -101,28 +101,28 @@ public async Task> } } - /// Gets a list of maintenance configurations in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// List AutoUpgradeProfile resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListByManagedClusterRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationListResult value = default; + AutoUpgradeProfileListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceMaintenanceConfigurationListResult.DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement); + value = AutoUpgradeProfileListResult.DeserializeAutoUpgradeProfileListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -130,7 +130,7 @@ public Response ListByManage } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string configName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -138,15 +138,15 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string configName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -157,10 +157,10 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -168,73 +168,73 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets the specified maintenance configuration of a managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Get a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile 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, string configName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, configName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationData value = default; + AutoUpgradeProfileData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement); + value = AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceMaintenanceConfigurationData)null, message.Response); + return Response.FromValue((AutoUpgradeProfileData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets the specified maintenance configuration of a managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Get a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile 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, string configName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, configName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationData value = default; + AutoUpgradeProfileData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement); + value = AutoUpgradeProfileData.DeserializeAutoUpgradeProfileData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceMaintenanceConfigurationData)null, message.Response); + return Response.FromValue((AutoUpgradeProfileData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string configName, ContainerServiceMaintenanceConfigurationData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, AutoUpgradeProfileData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -242,15 +242,15 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string configName, ContainerServiceMaintenanceConfigurationData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, AutoUpgradeProfileData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -261,12 +261,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, 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(); @@ -276,75 +284,69 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r return message; } - /// Creates or updates a maintenance configuration in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Create a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. - /// The maintenance configuration to create or update. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile resource. + /// Resource create parameters. + /// 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 configName, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, AutoUpgradeProfileData 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.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, configName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: - { - ContainerServiceMaintenanceConfigurationData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Creates or updates a maintenance configuration in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Create a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. - /// The maintenance configuration to create or update. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile resource. + /// Resource create parameters. + /// 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 configName, ContainerServiceMaintenanceConfigurationData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, AutoUpgradeProfileData 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.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, configName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 201: - { - ContainerServiceMaintenanceConfigurationData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceMaintenanceConfigurationData.DeserializeContainerServiceMaintenanceConfigurationData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string configName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -352,15 +354,15 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string configName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -371,37 +373,42 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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("/maintenanceConfigurations/", false); - uri.AppendPath(configName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/autoUpgradeProfiles/", false); + uri.AppendPath(autoUpgradeProfileName, 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"); _userAgent.Apply(message); return message; } - /// Deletes a maintenance configuration. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile resource. + /// 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 configName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, configName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -409,26 +416,27 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes a maintenance configuration. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a AutoUpgradeProfile. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of the maintenance configuration. + /// The name of the Fleet resource. + /// The name of the AutoUpgradeProfile resource. + /// 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 configName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fleetName, string autoUpgradeProfileName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configName, nameof(configName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(autoUpgradeProfileName, nameof(autoUpgradeProfileName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, configName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, autoUpgradeProfileName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: + case 202: case 204: return message.Response; default: @@ -436,7 +444,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string r } } - internal RequestUriBuilder CreateListByManagedClusterNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateListByFleetNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -444,7 +452,7 @@ internal RequestUriBuilder CreateListByManagedClusterNextPageRequestUri(string n return uri; } - internal HttpMessage CreateListByManagedClusterNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -458,30 +466,30 @@ internal HttpMessage CreateListByManagedClusterNextPageRequest(string nextLink, return message; } - /// Gets a list of maintenance configurations in the specified managed cluster. + /// List AutoUpgradeProfile resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationListResult value = default; + AutoUpgradeProfileListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceMaintenanceConfigurationListResult.DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement); + value = AutoUpgradeProfileListResult.DeserializeAutoUpgradeProfileListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -489,30 +497,30 @@ public async Task> } } - /// Gets a list of maintenance configurations in the specified managed cluster. + /// List AutoUpgradeProfile resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListByManagedClusterNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceMaintenanceConfigurationListResult value = default; + AutoUpgradeProfileListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceMaintenanceConfigurationListResult.DeserializeContainerServiceMaintenanceConfigurationListResult(document.RootElement); + value = AutoUpgradeProfileListResult.DeserializeAutoUpgradeProfileListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs new file mode 100644 index 000000000000..7155951ec3de --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetMembersRestOperations.cs @@ -0,0 +1,639 @@ +// 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 FleetMembersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of FleetMembersRestOperations. + /// 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 FleetMembersRestOperations(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-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListByFleetRequestUri(string subscriptionId, string resourceGroupName, string fleetName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List FleetMember resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FleetMemberListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FleetMemberListResult.DeserializeFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FleetMember resources by Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FleetMemberListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FleetMemberListResult.DeserializeFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member 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 fleetName, string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FleetMemberData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FleetMemberData.DeserializeFleetMemberData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FleetMemberData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member 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 fleetName, string fleetMemberName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FleetMemberData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FleetMemberData.DeserializeFleetMemberData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((FleetMemberData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberData data, string ifMatch, string ifNoneMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberData data, string ifMatch, string ifNoneMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, 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(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// 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 CreateAsync(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, data, ifMatch, ifNoneMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// Resource create parameters. + /// 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 Create(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, data, ifMatch, ifNoneMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberPatch patch, string ifMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberPatch patch, string ifMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, 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(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The resource properties to be updated. + /// 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 UpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, patch, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// The resource properties to be updated. + /// 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 Update(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, FleetMemberPatch patch, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, patch, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string fleetMemberName, string ifMatch) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/members/", false); + uri.AppendPath(fleetMemberName, 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"); + _userAgent.Apply(message); + return message; + } + + /// Delete a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// 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 fleetName, string fleetMemberName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, ifMatch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a FleetMember. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The name of the Fleet member resource. + /// 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 fleetName, string fleetMemberName, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(fleetMemberName, nameof(fleetMemberName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, fleetMemberName, ifMatch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByFleetNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) + { + 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; + } + + /// List FleetMember resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FleetMemberListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FleetMemberListResult.DeserializeFleetMemberListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List FleetMember resources by Fleet. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FleetMemberListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FleetMemberListResult.DeserializeFleetMemberListResult(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/TrustedAccessRoleBindingsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetUpdateStrategiesRestOperations.cs similarity index 59% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetUpdateStrategiesRestOperations.cs index c3e920e855a7..480107d1ba8f 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRoleBindingsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetUpdateStrategiesRestOperations.cs @@ -15,28 +15,28 @@ namespace Azure.ResourceManager.ContainerService { - internal partial class TrustedAccessRoleBindingsRestOperations + internal partial class FleetUpdateStrategiesRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of TrustedAccessRoleBindingsRestOperations. + /// Initializes a new instance of FleetUpdateStrategiesRestOperations. /// 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 TrustedAccessRoleBindingsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public FleetUpdateStrategiesRestOperations(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 ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateListByFleetRequestUri(string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,14 +44,14 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re 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("/trustedAccessRoleBindings", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -62,9 +62,9 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro 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("/trustedAccessRoleBindings", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -72,28 +72,28 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// List trusted access role bindings. - /// The ID of the target subscription. The value must be an UUID. + /// List FleetUpdateStrategy resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - TrustedAccessRoleBindingListResult value = default; + FleetUpdateStrategyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TrustedAccessRoleBindingListResult.DeserializeTrustedAccessRoleBindingListResult(document.RootElement); + value = FleetUpdateStrategyListResult.DeserializeFleetUpdateStrategyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -101,28 +101,28 @@ public async Task> ListAsync(string } } - /// List trusted access role bindings. - /// The ID of the target subscription. The value must be an UUID. + /// List FleetUpdateStrategy resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - TrustedAccessRoleBindingListResult value = default; + FleetUpdateStrategyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TrustedAccessRoleBindingListResult.DeserializeTrustedAccessRoleBindingListResult(document.RootElement); + value = FleetUpdateStrategyListResult.DeserializeFleetUpdateStrategyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -130,7 +130,7 @@ public Response List(string subscriptionId, } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -138,15 +138,15 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -157,10 +157,10 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -168,73 +168,73 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Get a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy 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, string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceTrustedAccessRoleBindingData value = default; + FleetUpdateStrategyData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement); + value = FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceTrustedAccessRoleBindingData)null, message.Response); + return Response.FromValue((FleetUpdateStrategyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Get a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy 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, string trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceTrustedAccessRoleBindingData value = default; + FleetUpdateStrategyData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceTrustedAccessRoleBindingData.DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement); + value = FleetUpdateStrategyData.DeserializeFleetUpdateStrategyData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceTrustedAccessRoleBindingData)null, message.Response); + return Response.FromValue((FleetUpdateStrategyData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, FleetUpdateStrategyData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -242,15 +242,15 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, FleetUpdateStrategyData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -261,12 +261,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, 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(); @@ -276,24 +284,26 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r return message; } - /// Create or update a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Create a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. - /// A trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy resource. + /// Resource create parameters. + /// 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 trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, FleetUpdateStrategyData 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.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -305,24 +315,26 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } } - /// Create or update a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Create a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. - /// A trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy resource. + /// Resource create parameters. + /// 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 trustedAccessRoleBindingName, ContainerServiceTrustedAccessRoleBindingData data, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, FleetUpdateStrategyData 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.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -334,7 +346,7 @@ public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -342,15 +354,15 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string trustedAccessRoleBindingName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -361,36 +373,42 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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("/trustedAccessRoleBindings/", false); - uri.AppendPath(trustedAccessRoleBindingName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateStrategies/", false); + uri.AppendPath(updateStrategyName, 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"); _userAgent.Apply(message); return message; } - /// Delete a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy resource. + /// 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 trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 200: case 202: case 204: return message.Response; @@ -399,25 +417,27 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Delete a trusted access role binding. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a FleetUpdateStrategy. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The name of trusted access role binding. + /// The name of the Fleet resource. + /// The name of the UpdateStrategy resource. + /// 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 trustedAccessRoleBindingName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fleetName, string updateStrategyName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(trustedAccessRoleBindingName, nameof(trustedAccessRoleBindingName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateStrategyName, nameof(updateStrategyName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, trustedAccessRoleBindingName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateStrategyName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 200: case 202: case 204: return message.Response; @@ -426,7 +446,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string r } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateListByFleetNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -434,7 +454,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -448,30 +468,30 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// List trusted access role bindings. + /// List FleetUpdateStrategy resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - TrustedAccessRoleBindingListResult value = default; + FleetUpdateStrategyListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TrustedAccessRoleBindingListResult.DeserializeTrustedAccessRoleBindingListResult(document.RootElement); + value = FleetUpdateStrategyListResult.DeserializeFleetUpdateStrategyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -479,30 +499,30 @@ public async Task> ListNextPageAsyn } } - /// List trusted access role bindings. + /// List FleetUpdateStrategy resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - TrustedAccessRoleBindingListResult value = default; + FleetUpdateStrategyListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TrustedAccessRoleBindingListResult.DeserializeTrustedAccessRoleBindingListResult(document.RootElement); + value = FleetUpdateStrategyListResult.DeserializeFleetUpdateStrategyListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs similarity index 62% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs index 5bb4a6a7ea25..ba5ca08c9260 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/SnapshotsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/FleetsRestOperations.cs @@ -15,39 +15,39 @@ namespace Azure.ResourceManager.ContainerService { - internal partial class SnapshotsRestOperations + internal partial class FleetsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of SnapshotsRestOperations. + /// Initializes a new instance of FleetsRestOperations. /// 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 SnapshotsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public FleetsRestOperations(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 ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateListRequestUri(string subscriptionId) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListRequest(string subscriptionId) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -56,7 +56,7 @@ internal HttpMessage CreateListRequest(string subscriptionId) uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -64,24 +64,24 @@ internal HttpMessage CreateListRequest(string subscriptionId) return message; } - /// Gets a list of snapshots in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. + /// Lists fleets in the specified subscription. + /// The ID of the target subscription. /// 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) + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -89,24 +89,24 @@ public async Task> ListAsync(string subscr } } - /// Gets a list of snapshots in the specified subscription. - /// The ID of the target subscription. The value must be an UUID. + /// Lists fleets in the specified subscription. + /// The ID of the target subscription. /// 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) + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListRequest(subscriptionId); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -122,7 +122,7 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -138,7 +138,7 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -146,13 +146,13 @@ internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, str return message; } - /// Lists snapshots in the specified subscription and resource group. - /// The ID of the target subscription. The value must be an UUID. + /// Lists fleets in the specified subscription and resource group. + /// The ID of the target subscription. /// 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) + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -163,9 +163,9 @@ public async Task> ListByResourceGroupAsyn { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -173,13 +173,13 @@ public async Task> ListByResourceGroupAsyn } } - /// Lists snapshots in the specified subscription and resource group. - /// The ID of the target subscription. The value must be an UUID. + /// Lists fleets in the specified subscription and resource group. + /// The ID of the target subscription. /// 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) + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); @@ -190,9 +190,9 @@ public Response ListByResourceGroup(string subscrip { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -200,7 +200,7 @@ public Response ListByResourceGroup(string subscrip } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -208,13 +208,13 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -225,8 +225,8 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -234,69 +234,69 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Gets a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotData value = default; + FleetData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); + value = FleetData.DeserializeFleetData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AgentPoolSnapshotData)null, message.Response); + return Response.FromValue((FleetData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Gets a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotData value = default; + FleetData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); + value = FleetData.DeserializeFleetData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((AgentPoolSnapshotData)null, message.Response); + return Response.FromValue((FleetData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, AgentPoolSnapshotData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, FleetData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -304,13 +304,13 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, AgentPoolSnapshotData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, FleetData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -321,10 +321,18 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, 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(); @@ -334,71 +342,65 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r return message; } - /// Creates or updates a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Creates or updates a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The snapshot to create or update. + /// The name of the Fleet resource. + /// Resource create parameters. + /// 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, AgentPoolSnapshotData data, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, FleetData 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.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: case 201: - { - AgentPoolSnapshotData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Creates or updates a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Creates or updates a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// The snapshot to create or update. + /// The name of the Fleet resource. + /// Resource create parameters. + /// 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, AgentPoolSnapshotData data, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string fleetName, FleetData 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.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: case 201: - { - AgentPoolSnapshotData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, FleetPatch patch, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -406,13 +408,13 @@ internal RequestUriBuilder CreateUpdateTagsRequestUri(string subscriptionId, str uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceTagsObject containerServiceTagsObject) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, FleetPatch patch, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -423,82 +425,80 @@ internal HttpMessage CreateUpdateTagsRequest(string subscriptionId, string resou uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, 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(); - content.JsonWriter.WriteObjectValue(containerServiceTagsObject, ModelSerializationExtensions.WireOptions); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Updates tags on a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Update a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// Parameters supplied to the Update snapshot Tags operation. + /// The name of the Fleet resource. + /// The resource properties to be updated. + /// 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, FleetPatch patch, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, patch, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - AgentPoolSnapshotData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Updates tags on a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Update a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. - /// Parameters supplied to the Update snapshot Tags operation. + /// The name of the Fleet resource. + /// The resource properties to be updated. + /// 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string fleetName, FleetPatch patch, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateTagsRequest(subscriptionId, resourceGroupName, resourceName, containerServiceTagsObject); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, fleetName, patch, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - AgentPoolSnapshotData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotData.DeserializeAgentPoolSnapshotData(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -506,13 +506,13 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -523,33 +523,39 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.ContainerService/snapshots/", false); - uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, 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"); _userAgent.Apply(message); return message; } - /// Deletes a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. + /// 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, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fleetName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: + case 202: case 204: return message.Response; default: @@ -557,24 +563,26 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes a snapshot. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. + /// 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, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fleetName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: + case 202: case 204: return message.Response; default: @@ -582,7 +590,101 @@ public Response Delete(string subscriptionId, string resourceGroupName, string r } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId) + internal RequestUriBuilder CreateListCredentialsRequestUri(string subscriptionId, string resourceGroupName, string fleetName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/listCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListCredentialsRequest(string subscriptionId, string resourceGroupName, string fleetName) + { + 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/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/listCredentials", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the user credentials of a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListCredentialsAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListCredentialsRequest(subscriptionId, resourceGroupName, fleetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + FleetCredentialResults value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = FleetCredentialResults.DeserializeFleetCredentialResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the user credentials of a Fleet. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of the Fleet resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListCredentials(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + + using var message = CreateListCredentialsRequest(subscriptionId, resourceGroupName, fleetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + FleetCredentialResults value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = FleetCredentialResults.DeserializeFleetCredentialResults(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -590,7 +692,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -604,26 +706,26 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// Gets a list of snapshots in the specified subscription. + /// Lists fleets 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 ID of the target subscription. /// 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) + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -631,26 +733,26 @@ public async Task> ListNextPageAsync(strin } } - /// Gets a list of snapshots in the specified subscription. + /// Lists fleets 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 ID of the target subscription. /// 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) + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId); + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -680,14 +782,14 @@ internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, s return message; } - /// Lists snapshots in the specified subscription and resource group. + /// Lists fleets 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 ID of the target subscription. /// 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) + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -699,9 +801,9 @@ public async Task> ListByResourceGroupNext { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -709,14 +811,14 @@ public async Task> ListByResourceGroupNext } } - /// Lists snapshots in the specified subscription and resource group. + /// Lists fleets 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 ID of the target subscription. /// 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) + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); @@ -728,9 +830,9 @@ public Response ListByResourceGroupNextPage(string { case 200: { - AgentPoolSnapshotListResult value = default; + FleetListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolSnapshotListResult.DeserializeAgentPoolSnapshotListResult(document.RootElement); + value = FleetListResult.DeserializeFleetListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs deleted file mode 100644 index 503359a3f987..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ManagedClustersRestOperations.cs +++ /dev/null @@ -1,2957 +0,0 @@ -// 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 ManagedClustersRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ManagedClustersRestOperations. - /// 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 ManagedClustersRestOperations(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 ?? "2023-10-01"; - _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, default, 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); - 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(); - uri.Reset(_endpoint); - uri.AppendPath("/subscriptions/", false); - uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.ContainerService/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/kubernetesVersions", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListKubernetesVersionsRequest(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("/kubernetesVersions", 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 the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the 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 async Task> ListKubernetesVersionsAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListKubernetesVersionsRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - KubernetesVersionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = KubernetesVersionListResult.DeserializeKubernetesVersionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Contains extra metadata on the version, including supported patch versions, capabilities, available upgrades, and details on preview status of the 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 ListKubernetesVersions(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListKubernetesVersionsRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - KubernetesVersionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = KubernetesVersionListResult.DeserializeKubernetesVersionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - 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/managedClusters", 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/managedClusters", 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 clusters 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: - { - ManagedClusterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of managed clusters 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: - { - ManagedClusterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(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/managedClusters", 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/managedClusters", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists managed clusters 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: - { - ManagedClusterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists managed clusters 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: - { - ManagedClusterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetUpgradeProfileRequestUri(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("/upgradeProfiles/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetUpgradeProfileRequest(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("/upgradeProfiles/default", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the upgrade profile 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> GetUpgradeProfileAsync(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 = CreateGetUpgradeProfileRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterUpgradeProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterUpgradeProfileData.DeserializeManagedClusterUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ManagedClusterUpgradeProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the upgrade profile 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response GetUpgradeProfile(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 = CreateGetUpgradeProfileRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterUpgradeProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterUpgradeProfileData.DeserializeManagedClusterUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ManagedClusterUpgradeProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetAccessProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string roleName) - { - 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("/accessProfiles/", false); - uri.AppendPath(roleName, true); - uri.AppendPath("/listCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetAccessProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, string roleName) - { - 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("/accessProfiles/", false); - uri.AppendPath(roleName, 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; - } - - /// **WARNING**: This API will be deprecated. Instead use [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . - /// 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 role for managed cluster accessProfile resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetAccessProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, string roleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); - - using var message = CreateGetAccessProfileRequest(subscriptionId, resourceGroupName, resourceName, roleName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterAccessProfile value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterAccessProfile.DeserializeManagedClusterAccessProfile(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// **WARNING**: This API will be deprecated. Instead use [ListClusterUserCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusterusercredentials) or [ListClusterAdminCredentials](https://docs.microsoft.com/rest/api/aks/managedclusters/listclusteradmincredentials) . - /// 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 role for managed cluster accessProfile resource. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetAccessProfile(string subscriptionId, string resourceGroupName, string resourceName, string roleName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(roleName, nameof(roleName)); - - using var message = CreateGetAccessProfileRequest(subscriptionId, resourceGroupName, resourceName, roleName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterAccessProfile value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterAccessProfile.DeserializeManagedClusterAccessProfile(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListClusterAdminCredentialsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn) - { - 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("/listClusterAdminCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - return uri; - } - - internal HttpMessage CreateListClusterAdminCredentialsRequest(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn) - { - 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("/listClusterAdminCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the admin credentials 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. - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListClusterAdminCredentialsAsync(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterAdminCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn); - 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, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the admin credentials 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. - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListClusterAdminCredentials(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterAdminCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterCredentials value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListClusterUserCredentialsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn, KubeConfigFormat? format) - { - 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("/listClusterUserCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - if (format != null) - { - uri.AppendQuery("format", format.Value.ToString(), true); - } - return uri; - } - - internal HttpMessage CreateListClusterUserCredentialsRequest(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn, KubeConfigFormat? format) - { - 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("/listClusterUserCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - if (format != null) - { - uri.AppendQuery("format", format.Value.ToString(), true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the user credentials 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. - /// server fqdn type for credentials to be returned. - /// Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires kubelogin binary in the path. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListClusterUserCredentialsAsync(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, KubeConfigFormat? format = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterUserCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn, format); - 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, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the user credentials 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. - /// server fqdn type for credentials to be returned. - /// Only apply to AAD clusters, specifies the format of returned kubeconfig. Format 'azure' will return azure auth-provider kubeconfig; format 'exec' will return exec format kubeconfig, which requires kubelogin binary in the path. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListClusterUserCredentials(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, KubeConfigFormat? format = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterUserCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn, format); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterCredentials value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListClusterMonitoringUserCredentialsRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn) - { - 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("/listClusterMonitoringUserCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - return uri; - } - - internal HttpMessage CreateListClusterMonitoringUserCredentialsRequest(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn) - { - 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("/listClusterMonitoringUserCredential", false); - uri.AppendQuery("api-version", _apiVersion, true); - if (serverFqdn != null) - { - uri.AppendQuery("server-fqdn", serverFqdn, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Lists the cluster monitoring user credentials 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. - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> ListClusterMonitoringUserCredentialsAsync(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterMonitoringUserCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn); - 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, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists the cluster monitoring user credentials 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. - /// server fqdn type for credentials to be returned. - /// The cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ListClusterMonitoringUserCredentials(string subscriptionId, string resourceGroupName, string resourceName, string serverFqdn = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateListClusterMonitoringUserCredentialsRequest(subscriptionId, resourceGroupName, resourceName, serverFqdn); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterCredentials value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterCredentials.DeserializeManagedClusterCredentials(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/managedClusters/", 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/managedClusters/", 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. - /// 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: - { - ContainerServiceManagedClusterData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ContainerServiceManagedClusterData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets 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 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: - { - ContainerServiceManagedClusterData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceManagedClusterData.DeserializeContainerServiceManagedClusterData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ContainerServiceManagedClusterData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData 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.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServiceManagedClusterData 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.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. - /// 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 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, ContainerServiceManagedClusterData 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: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates or updates 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 managed cluster 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, ContainerServiceManagedClusterData 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: - return 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/managedClusters/", 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/managedClusters/", 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. - /// 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 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: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates tags on 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. - /// Parameters supplied to the Update Managed Cluster 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: - return 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/managedClusters/", 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/managedClusters/", 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. - /// 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 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes 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 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 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateResetServicePrincipalProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile) - { - 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("/resetServicePrincipalProfile", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateResetServicePrincipalProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile) - { - 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("/resetServicePrincipalProfile", 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(managedClusterServicePrincipalProfile, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// This action cannot be performed on a cluster that is not using a service principal. - /// 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 service principal profile to set on the managed cluster. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ResetServicePrincipalProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(managedClusterServicePrincipalProfile, nameof(managedClusterServicePrincipalProfile)); - - using var message = CreateResetServicePrincipalProfileRequest(subscriptionId, resourceGroupName, resourceName, managedClusterServicePrincipalProfile); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// This action cannot be performed on a cluster that is not using a service principal. - /// 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 service principal profile to set on the managed cluster. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ResetServicePrincipalProfile(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterServicePrincipalProfile managedClusterServicePrincipalProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(managedClusterServicePrincipalProfile, nameof(managedClusterServicePrincipalProfile)); - - using var message = CreateResetServicePrincipalProfileRequest(subscriptionId, resourceGroupName, resourceName, managedClusterServicePrincipalProfile); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateResetAadProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterAadProfile managedClusterAadProfile) - { - 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("/resetAADProfile", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateResetAadProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterAadProfile managedClusterAadProfile) - { - 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("/resetAADProfile", 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(managedClusterAadProfile, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// **WARNING**: This API will be deprecated. Please see [AKS-managed Azure Active Directory integration](https://aka.ms/aks-managed-aad) to update your cluster with AKS-managed Azure AD. - /// 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 AAD profile to set on the Managed Cluster. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task ResetAadProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterAadProfile managedClusterAadProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(managedClusterAadProfile, nameof(managedClusterAadProfile)); - - using var message = CreateResetAadProfileRequest(subscriptionId, resourceGroupName, resourceName, managedClusterAadProfile); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// **WARNING**: This API will be deprecated. Please see [AKS-managed Azure Active Directory integration](https://aka.ms/aks-managed-aad) to update your cluster with AKS-managed Azure AD. - /// 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 AAD profile to set on the Managed Cluster. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response ResetAadProfile(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterAadProfile managedClusterAadProfile, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(managedClusterAadProfile, nameof(managedClusterAadProfile)); - - using var message = CreateResetAadProfileRequest(subscriptionId, resourceGroupName, resourceName, managedClusterAadProfile); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRotateClusterCertificatesRequestUri(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("/rotateClusterCertificates", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRotateClusterCertificatesRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - 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("/rotateClusterCertificates", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// 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 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 = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// 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 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 = CreateRotateClusterCertificatesRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateAbortLatestOperationRequestUri(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("/abort", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - 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("/abort", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - 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. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// 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. - /// 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) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - using var message = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRotateServiceAccountSigningKeysRequestUri(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("/rotateServiceAccountSigningKeys", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRotateServiceAccountSigningKeysRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - 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("/rotateServiceAccountSigningKeys", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Rotates the service account signing keys 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task RotateServiceAccountSigningKeysAsync(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 = CreateRotateServiceAccountSigningKeysRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Rotates the service account signing keys 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response RotateServiceAccountSigningKeys(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 = CreateRotateServiceAccountSigningKeysRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStopRequestUri(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("/stop", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - 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("/stop", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task StopAsync(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 = CreateStopRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// This can only be performed on Azure Virtual Machine Scale set backed clusters. Stopping a cluster stops the control plane and agent nodes entirely, while maintaining all object and cluster state. A cluster does not accrue charges while it is stopped. See [stopping a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about stopping 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Stop(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 = CreateStopRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateStartRequestUri(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("/start", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string resourceName) - { - 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("/start", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task StartAsync(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 = CreateStartRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// See [starting a cluster](https://docs.microsoft.com/azure/aks/start-stop-cluster) for more details about starting 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 cancellation token to use. - /// , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Start(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 = CreateStartRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateRunCommandRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterRunCommandContent content) - { - 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("/runCommand", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateRunCommandRequest(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterRunCommandContent content) - { - 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("/runCommand", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content0 = new Utf8JsonRequestContent(); - content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); - request.Content = content0; - _userAgent.Apply(message); - return message; - } - - /// AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). - /// 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 run command request. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task RunCommandAsync(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterRunCommandContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRunCommandRequest(subscriptionId, resourceGroupName, resourceName, content); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// AKS will create a pod to run the command. This is primarily useful for private clusters. For more information see [AKS Run Command](https://docs.microsoft.com/azure/aks/private-clusters#aks-run-command-preview). - /// 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 run command request. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response RunCommand(string subscriptionId, string resourceGroupName, string resourceName, ManagedClusterRunCommandContent content, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNull(content, nameof(content)); - - using var message = CreateRunCommandRequest(subscriptionId, resourceGroupName, resourceName, content); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetCommandResultRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string commandId) - { - 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("/commandResults/", false); - uri.AppendPath(commandId, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetCommandResultRequest(string subscriptionId, string resourceGroupName, string resourceName, string commandId) - { - 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("/commandResults/", false); - uri.AppendPath(commandId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Gets the results of a command which has been run on the 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. - /// Id of the command. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public async Task> GetCommandResultAsync(string subscriptionId, string resourceGroupName, string resourceName, string commandId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - using var message = CreateGetCommandResultRequest(subscriptionId, resourceGroupName, resourceName, commandId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterRunCommandResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterRunCommandResult.DeserializeManagedClusterRunCommandResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 202: - return Response.FromValue((ManagedClusterRunCommandResult)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the results of a command which has been run on the 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. - /// Id of the command. - /// The cancellation token to use. - /// , , or is null. - /// , , or is an empty string, and was expected to be non-empty. - public Response GetCommandResult(string subscriptionId, string resourceGroupName, string resourceName, string commandId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(commandId, nameof(commandId)); - - using var message = CreateGetCommandResultRequest(subscriptionId, resourceGroupName, resourceName, commandId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ManagedClusterRunCommandResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterRunCommandResult.DeserializeManagedClusterRunCommandResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 202: - return Response.FromValue((ManagedClusterRunCommandResult)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOutboundNetworkDependenciesEndpointsRequestUri(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("/outboundNetworkDependenciesEndpoints", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListOutboundNetworkDependenciesEndpointsRequest(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("/outboundNetworkDependenciesEndpoints", 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 egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// 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> ListOutboundNetworkDependenciesEndpointsAsync(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 = CreateListOutboundNetworkDependenciesEndpointsRequest(subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OutboundEnvironmentEndpointListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OutboundEnvironmentEndpointListResult.DeserializeOutboundEnvironmentEndpointListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// 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 ListOutboundNetworkDependenciesEndpoints(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 = CreateListOutboundNetworkDependenciesEndpointsRequest(subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OutboundEnvironmentEndpointListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OutboundEnvironmentEndpointListResult.DeserializeOutboundEnvironmentEndpointListResult(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, default, 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); - 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, default, 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); - 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, default, 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); - 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); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - MeshUpgradeProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = MeshUpgradeProfileData.DeserializeMeshUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((MeshUpgradeProfileData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// 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 Response GetMeshUpgradeProfile(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); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MeshUpgradeProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MeshUpgradeProfileData.DeserializeMeshUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((MeshUpgradeProfileData)null, 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 clusters 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: - { - ManagedClusterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of managed clusters 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: - { - ManagedClusterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(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 clusters 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: - { - ManagedClusterListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Lists managed clusters 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: - { - ManagedClusterListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ManagedClusterListResult.DeserializeManagedClusterListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListOutboundNetworkDependenciesEndpointsNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(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 egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// 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> ListOutboundNetworkDependenciesEndpointsNextPageAsync(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 = CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - OutboundEnvironmentEndpointListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = OutboundEnvironmentEndpointListResult.DeserializeOutboundEnvironmentEndpointListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a list of egress endpoints (network endpoints of all outbound dependencies) in the specified managed cluster. The operation returns properties of each egress endpoint. - /// 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 ListOutboundNetworkDependenciesEndpointsNextPage(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 = CreateListOutboundNetworkDependenciesEndpointsNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - OutboundEnvironmentEndpointListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = OutboundEnvironmentEndpointListResult.DeserializeOutboundEnvironmentEndpointListResult(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(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListMeshRevisionProfilesNextPageRequest(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 extra metadata on each revision, including supported revisions, cluster compatibility and available upgrades. - /// 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> ListMeshRevisionProfilesNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListMeshRevisionProfilesNextPageRequest(nextLink, 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, default, 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 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 ListMeshRevisionProfilesNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListMeshRevisionProfilesNextPageRequest(nextLink, subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MeshRevisionProfileList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MeshRevisionProfileList.DeserializeMeshRevisionProfileList(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListMeshUpgradeProfilesNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListMeshUpgradeProfilesNextPageRequest(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; - } - - /// Lists available upgrades for all service meshes in a specific 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> ListMeshUpgradeProfilesNextPageAsync(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 = CreateListMeshUpgradeProfilesNextPageRequest(nextLink, 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, default, 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 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 ListMeshUpgradeProfilesNextPage(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 = CreateListMeshUpgradeProfilesNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - MeshUpgradeProfileList value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = MeshUpgradeProfileList.DeserializeMeshUpgradeProfileList(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 deleted file mode 100644 index 856fc34d8ad9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ /dev/null @@ -1,439 +0,0 @@ -// 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 PrivateEndpointConnectionsRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. - /// 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 PrivateEndpointConnectionsRestOperations(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 ?? "2023-10-01"; - _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("/privateEndpointConnections", 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("/privateEndpointConnections", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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: - { - ContainerServicePrivateEndpointConnectionListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServicePrivateEndpointConnectionListResult.DeserializeContainerServicePrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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: - { - ContainerServicePrivateEndpointConnectionListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServicePrivateEndpointConnectionListResult.DeserializeContainerServicePrivateEndpointConnectionListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) - { - 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) - { - 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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 private endpoint connection. - /// 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ContainerServicePrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ContainerServicePrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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 private endpoint connection. - /// 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ContainerServicePrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((ContainerServicePrivateEndpointConnectionData)null, message.Response); - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, 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; - } - - /// Updates a private endpoint connection. - /// 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 private endpoint connection. - /// The updated private endpoint connection. - /// 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 privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - ContainerServicePrivateEndpointConnectionData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Updates a private endpoint connection. - /// 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 private endpoint connection. - /// The updated private endpoint connection. - /// 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 privateEndpointConnectionName, ContainerServicePrivateEndpointConnectionData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(data, nameof(data)); - - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - ContainerServicePrivateEndpointConnectionData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServicePrivateEndpointConnectionData.DeserializeContainerServicePrivateEndpointConnectionData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) - { - 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string privateEndpointConnectionName) - { - 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("/privateEndpointConnections/", false); - uri.AppendPath(privateEndpointConnectionName, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// Deletes a private endpoint connection. - /// 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 private endpoint connection. - /// 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); - 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 private endpoint connection. - /// 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 private endpoint connection. - /// 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 privateEndpointConnectionName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, privateEndpointConnectionName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - } -} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs deleted file mode 100644 index 49dbd76496a9..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs +++ /dev/null @@ -1,133 +0,0 @@ -// 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 PrivateLinkResourcesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of PrivateLinkResourcesRestOperations. - /// 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 PrivateLinkResourcesRestOperations(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 ?? "2023-10-01"; - _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("/privateLinkResources", 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("/privateLinkResources", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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: - { - ContainerServicePrivateLinkResourcesListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServicePrivateLinkResourcesListResult.DeserializeContainerServicePrivateLinkResourcesListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters. - /// 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: - { - ContainerServicePrivateLinkResourcesListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServicePrivateLinkResourcesListResult.DeserializeContainerServicePrivateLinkResourcesListResult(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/ResolvePrivateLinkServiceIdRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs deleted file mode 100644 index 079e3871afa5..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/ResolvePrivateLinkServiceIdRestOperations.cs +++ /dev/null @@ -1,141 +0,0 @@ -// 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 ResolvePrivateLinkServiceIdRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of ResolvePrivateLinkServiceIdRestOperations. - /// 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 ResolvePrivateLinkServiceIdRestOperations(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 ?? "2023-10-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreatePostRequestUri(string subscriptionId, string resourceGroupName, string resourceName, ContainerServicePrivateLinkResourceData 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("/resolvePrivateLinkServiceId", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreatePostRequest(string subscriptionId, string resourceGroupName, string resourceName, ContainerServicePrivateLinkResourceData data) - { - 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("/resolvePrivateLinkServiceId", 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(data, ModelSerializationExtensions.WireOptions); - request.Content = content; - _userAgent.Apply(message); - return message; - } - - /// Gets the private link service ID for 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. - /// Parameters required in order to resolve a private link service ID. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task> PostAsync(string subscriptionId, string resourceGroupName, string resourceName, ContainerServicePrivateLinkResourceData 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 = CreatePostRequest(subscriptionId, resourceGroupName, resourceName, data); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - ContainerServicePrivateLinkResourceData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets the private link service ID for 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. - /// Parameters required in order to resolve a private link service ID. - /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Post(string subscriptionId, string resourceGroupName, string resourceName, ContainerServicePrivateLinkResourceData 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 = CreatePostRequest(subscriptionId, resourceGroupName, resourceName, data); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - ContainerServicePrivateLinkResourceData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServicePrivateLinkResourceData.DeserializeContainerServicePrivateLinkResourceData(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/TrustedAccessRolesRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs deleted file mode 100644 index 5132b6d8d9f1..000000000000 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/TrustedAccessRolesRestOperations.cs +++ /dev/null @@ -1,201 +0,0 @@ -// 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 TrustedAccessRolesRestOperations - { - private readonly TelemetryDetails _userAgent; - private readonly HttpPipeline _pipeline; - private readonly Uri _endpoint; - private readonly string _apiVersion; - - /// Initializes a new instance of TrustedAccessRolesRestOperations. - /// 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 TrustedAccessRolesRestOperations(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 ?? "2023-10-01"; - _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); - } - - internal RequestUriBuilder CreateListRequestUri(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("/trustedAccessRoles", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(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("/trustedAccessRoles", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - return message; - } - - /// List supported trusted access roles. - /// 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> ListAsync(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - TrustedAccessRoleListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TrustedAccessRoleListResult.DeserializeTrustedAccessRoleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List supported trusted access roles. - /// 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 List(string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListRequest(subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - TrustedAccessRoleListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TrustedAccessRoleListResult.DeserializeTrustedAccessRoleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, AzureLocation location) - { - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRawNextLink(nextLink, false); - return uri; - } - - internal HttpMessage CreateListNextPageRequest(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; - } - - /// List supported trusted access roles. - /// 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> ListNextPageAsync(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - TrustedAccessRoleListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = TrustedAccessRoleListResult.DeserializeTrustedAccessRoleListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// List supported trusted access roles. - /// 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 ListNextPage(string nextLink, string subscriptionId, AzureLocation location, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(nextLink, nameof(nextLink)); - Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - - using var message = CreateListNextPageRequest(nextLink, subscriptionId, location); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - TrustedAccessRoleListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = TrustedAccessRoleListResult.DeserializeTrustedAccessRoleListResult(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/AgentPoolsRestOperations.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/UpdateRunsRestOperations.cs similarity index 50% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/UpdateRunsRestOperations.cs index ed1c05c551de..9a426ff94f37 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/AgentPoolsRestOperations.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/RestOperations/UpdateRunsRestOperations.cs @@ -15,28 +15,28 @@ namespace Azure.ResourceManager.ContainerService { - internal partial class AgentPoolsRestOperations + internal partial class UpdateRunsRestOperations { private readonly TelemetryDetails _userAgent; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; - /// Initializes a new instance of AgentPoolsRestOperations. + /// Initializes a new instance of UpdateRunsRestOperations. /// 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 AgentPoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + public UpdateRunsRestOperations(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 ?? "2023-10-01"; + _apiVersion = apiVersion ?? "2025-03-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateAbortLatestOperationRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateListByFleetRequestUri(string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -44,108 +44,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(resourceName, true); - uri.AppendPath("/agentPools/", false); - uri.AppendPath(agentPoolName, true); - uri.AppendPath("/abort", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateAbortLatestOperationRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) - { - 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("/abort", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - _userAgent.Apply(message); - 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. - /// 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 AbortLatestOperationAsync(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 = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// 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. - /// 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 AbortLatestOperation(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 = CreateAbortLatestOperationRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 202: - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - 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("/agentPools", false); - uri.AppendQuery("api-version", _apiVersion, true); - return uri; - } - - internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetRequest(string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -156,9 +62,9 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -166,28 +72,28 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro return message; } - /// Gets a list of agent pools in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// List UpdateRun resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetAsync(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolListResult value = default; + UpdateRunListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceAgentPoolListResult.DeserializeContainerServiceAgentPoolListResult(document.RootElement); + value = UpdateRunListResult.DeserializeUpdateRunListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -195,28 +101,28 @@ public async Task> ListAsync(strin } } - /// Gets a list of agent pools in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// List UpdateRun resources by Fleet. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleet(string subscriptionId, string resourceGroupName, string fleetName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); - using var message = CreateListRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetRequest(subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolListResult value = default; + UpdateRunListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceAgentPoolListResult.DeserializeContainerServiceAgentPoolListResult(document.RootElement); + value = UpdateRunListResult.DeserializeUpdateRunListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -224,7 +130,7 @@ public Response List(string subscriptionId, } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -232,15 +138,15 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -251,10 +157,10 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -262,73 +168,73 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Gets the specified managed cluster agent pool. - /// The ID of the target subscription. The value must be an UUID. + /// Get a UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun 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, string agentPoolName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateRunName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolData value = default; + UpdateRunData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(document.RootElement); + value = UpdateRunData.DeserializeUpdateRunData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceAgentPoolData)null, message.Response); + return Response.FromValue((UpdateRunData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Gets the specified managed cluster agent pool. - /// The ID of the target subscription. The value must be an UUID. + /// Get a UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun 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, string agentPoolName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, fleetName, updateRunName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolData value = default; + UpdateRunData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceAgentPoolData.DeserializeContainerServiceAgentPoolData(document.RootElement); + value = UpdateRunData.DeserializeUpdateRunData(document.RootElement); return Response.FromValue(value, message.Response); } case 404: - return Response.FromValue((ContainerServiceAgentPoolData)null, message.Response); + return Response.FromValue((UpdateRunData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, UpdateRunData data, string ifMatch, string ifNoneMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -336,15 +242,15 @@ internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, ContainerServiceAgentPoolData data) + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, UpdateRunData data, string ifMatch, string ifNoneMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -355,12 +261,20 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, 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(); @@ -370,24 +284,26 @@ internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string r return message; } - /// Creates or updates an agent pool in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Create a UpdateRun. + /// The ID of the target subscription. /// 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 agent pool to create or update. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// 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) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, UpdateRunData 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.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, data, ifMatch, ifNoneMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -399,24 +315,26 @@ public async Task CreateOrUpdateAsync(string subscriptionId, string re } } - /// Creates or updates an agent pool in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Create a UpdateRun. + /// The ID of the target subscription. /// 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 agent pool to create or update. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// Resource create parameters. + /// 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) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, UpdateRunData 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.AssertNotNullOrEmpty(agentPoolName, nameof(agentPoolName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); Argument.AssertNotNull(data, nameof(data)); - using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName, data); + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, data, ifMatch, ifNoneMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -428,7 +346,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 fleetName, string updateRunName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -436,15 +354,15 @@ internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -455,36 +373,42 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG 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("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, 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"); _userAgent.Apply(message); return message; } - /// Deletes an agent pool in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 200: case 202: case 204: return message.Response; @@ -493,25 +417,27 @@ public async Task DeleteAsync(string subscriptionId, string resourceGr } } - /// Deletes an agent pool in the specified managed cluster. - /// The ID of the target subscription. The value must be an UUID. + /// Delete a UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 200: case 202: case 204: return message.Response; @@ -520,7 +446,7 @@ public Response Delete(string subscriptionId, string resourceGroupName, string r } } - internal RequestUriBuilder CreateGetUpgradeProfileRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateSkipRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, SkipProperties body, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -528,105 +454,107 @@ internal RequestUriBuilder CreateGetUpgradeProfileRequestUri(string subscription 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("/upgradeProfiles/default", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/skip", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetUpgradeProfileRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateSkipRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, SkipProperties body, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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("/upgradeProfiles/default", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/skip", false); 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(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Gets the upgrade profile for an agent pool. - /// The ID of the target subscription. The value must be an UUID. + /// Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The content of the action request. + /// 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> GetUpgradeProfileAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task SkipAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, SkipProperties body, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(body, nameof(body)); - using var message = CreateGetUpgradeProfileRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateSkipRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, body, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - AgentPoolUpgradeProfileData value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolUpgradeProfileData.DeserializeAgentPoolUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AgentPoolUpgradeProfileData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Gets the upgrade profile for an agent pool. - /// The ID of the target subscription. The value must be an UUID. + /// Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// The content of the action request. + /// 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 GetUpgradeProfile(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Skip(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, SkipProperties body, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(body, nameof(body)); - using var message = CreateGetUpgradeProfileRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateSkipRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, body, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - AgentPoolUpgradeProfileData value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolUpgradeProfileData.DeserializeAgentPoolUpgradeProfileData(document.RootElement); - return Response.FromValue(value, message.Response); - } - case 404: - return Response.FromValue((AgentPoolUpgradeProfileData)null, message.Response); + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetAvailableAgentPoolVersionsRequestUri(string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateStartRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -634,93 +562,99 @@ internal RequestUriBuilder CreateGetAvailableAgentPoolVersionsRequestUri(string 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("/availableAgentPoolVersions", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/start", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetAvailableAgentPoolVersionsRequest(string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + 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("/availableAgentPoolVersions", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/start", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. - /// The ID of the target subscription. The value must be an UUID. + /// Starts an UpdateRun. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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> GetAvailableAgentPoolVersionsAsync(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 StartAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateGetAvailableAgentPoolVersionsRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateStartRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - AgentPoolAvailableVersions value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AgentPoolAvailableVersions.DeserializeAgentPoolAvailableVersions(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// See [supported Kubernetes versions](https://docs.microsoft.com/azure/aks/supported-kubernetes-versions) for more details about the version lifecycle. - /// The ID of the target subscription. The value must be an UUID. + /// Starts an UpdateRun. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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 GetAvailableAgentPoolVersions(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 Start(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch = null, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateGetAvailableAgentPoolVersionsRequest(subscriptionId, resourceGroupName, resourceName); + using var message = CreateStartRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - AgentPoolAvailableVersions value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AgentPoolAvailableVersions.DeserializeAgentPoolAvailableVersions(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpgradeNodeImageVersionRequestUri(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal RequestUriBuilder CreateStopRequestUri(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -728,16 +662,16 @@ internal RequestUriBuilder CreateUpgradeNodeImageVersionRequestUri(string subscr 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("/upgradeNodeImageVersion", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/stop", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateUpgradeNodeImageVersionRequest(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName) + internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, string ifMatch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -748,34 +682,39 @@ internal HttpMessage CreateUpgradeNodeImageVersionRequest(string subscriptionId, 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("/upgradeNodeImageVersion", false); + uri.AppendPath("/providers/Microsoft.ContainerService/fleets/", false); + uri.AppendPath(fleetName, true); + uri.AppendPath("/updateRuns/", false); + uri.AppendPath(updateRunName, true); + uri.AppendPath("/stop", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + if (ifMatch != null) + { + request.Headers.Add("If-Match", ifMatch); + } request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } - /// 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. - /// The ID of the target subscription. The value must be an UUID. + /// Stops an UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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 UpgradeNodeImageVersionAsync(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task StopAsync(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateUpgradeNodeImageVersionRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateStopRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { @@ -787,22 +726,23 @@ public async Task UpgradeNodeImageVersionAsync(string subscriptionId, } } - /// 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. - /// The ID of the target subscription. The value must be an UUID. + /// Stops an UpdateRun. + /// The ID of the target subscription. /// 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 name of the Fleet resource. + /// The name of the UpdateRun resource. + /// 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 UpgradeNodeImageVersion(string subscriptionId, string resourceGroupName, string resourceName, string agentPoolName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Stop(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName, 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)); + Argument.AssertNotNullOrEmpty(fleetName, nameof(fleetName)); + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); - using var message = CreateUpgradeNodeImageVersionRequest(subscriptionId, resourceGroupName, resourceName, agentPoolName); + using var message = CreateStopRequest(subscriptionId, resourceGroupName, fleetName, updateRunName, ifMatch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { @@ -814,7 +754,7 @@ public Response UpgradeNodeImageVersion(string subscriptionId, string resourceGr } } - internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal RequestUriBuilder CreateListByFleetNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -822,7 +762,7 @@ internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string return uri; } - internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string resourceName) + internal HttpMessage CreateListByFleetNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string fleetName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -836,30 +776,30 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string subscript return message; } - /// Gets a list of agent pools in the specified managed cluster. + /// List UpdateRun resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByFleetNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolListResult value = default; + UpdateRunListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = ContainerServiceAgentPoolListResult.DeserializeContainerServiceAgentPoolListResult(document.RootElement); + value = UpdateRunListResult.DeserializeUpdateRunListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -867,30 +807,30 @@ public async Task> ListNextPageAsy } } - /// Gets a list of agent pools in the specified managed cluster. + /// List UpdateRun resources by Fleet. /// The URL to the next page of results. - /// The ID of the target subscription. The value must be an UUID. + /// The ID of the target subscription. /// The name of the resource group. The name is case insensitive. - /// The name of the managed cluster resource. + /// The name of the Fleet 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) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByFleetNextPage(string nextLink, string subscriptionId, string resourceGroupName, string fleetName, 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(fleetName, nameof(fleetName)); - using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, resourceName); + using var message = CreateListByFleetNextPageRequest(nextLink, subscriptionId, resourceGroupName, fleetName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - ContainerServiceAgentPoolListResult value = default; + UpdateRunListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = ContainerServiceAgentPoolListResult.DeserializeContainerServiceAgentPoolListResult(document.RootElement); + value = UpdateRunListResult.DeserializeUpdateRunListResult(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunCollection.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunCollection.cs new file mode 100644 index 000000000000..76cf384239a1 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunCollection.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 an instance call the GetUpdateRuns method from an instance of . + /// + public partial class UpdateRunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _updateRunClientDiagnostics; + private readonly UpdateRunsRestOperations _updateRunRestClient; + + /// Initializes a new instance of the class for mocking. + protected UpdateRunCollection() + { + } + + /// 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 UpdateRunCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _updateRunClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", UpdateRunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(UpdateRunResource.ResourceType, out string updateRunApiVersion); + _updateRunRestClient = new UpdateRunsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, updateRunApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != FleetResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, FleetResource.ResourceType), nameof(id)); + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 UpdateRun resource. + /// Resource create parameters. + /// 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 updateRunName, UpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _updateRunRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 UpdateRun resource. + /// Resource create parameters. + /// 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 updateRunName, UpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _updateRunRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.Get"); + scope.Start(); + try + { + var response = await _updateRunRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.Get"); + scope.Start(); + try + { + var response = _updateRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List UpdateRun resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns + /// + /// + /// Operation Id + /// UpdateRuns_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _updateRunRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRunRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List UpdateRun resources by Fleet + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns + /// + /// + /// Operation Id + /// UpdateRuns_ListByFleet + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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) => _updateRunRestClient.CreateListByFleetRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _updateRunRestClient.CreateListByFleetNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new UpdateRunResource(Client, UpdateRunData.DeserializeUpdateRunData(e)), _updateRunClientDiagnostics, Pipeline, "UpdateRunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.Exists"); + scope.Start(); + try + { + var response = await _updateRunRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, 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/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.Exists"); + scope.Start(); + try + { + var response = _updateRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, 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/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun 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 updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _updateRunRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(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/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the UpdateRun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string updateRunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(updateRunName, nameof(updateRunName)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _updateRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, updateRunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(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/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.Serialization.cs similarity index 56% rename from sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs rename to sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.Serialization.cs index e5bc2710de83..87442cc9f8ad 100644 --- a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/ContainerServiceTrustedAccessRoleBindingData.Serialization.cs +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.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 ContainerServiceTrustedAccessRoleBindingData : IUtf8JsonSerializable, IJsonModel + public partial class UpdateRunData : 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,13 +31,18 @@ void IJsonModel.Write(Utf8JsonWrit /// 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(ContainerServiceTrustedAccessRoleBindingData)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunData)} 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()); + } writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) @@ -46,31 +50,42 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("provisioningState"u8); writer.WriteStringValue(ProvisioningState.Value.ToString()); } - writer.WritePropertyName("sourceResourceId"u8); - writer.WriteStringValue(SourceResourceId); - writer.WritePropertyName("roles"u8); - writer.WriteStartArray(); - foreach (var item in Roles) + if (Optional.IsDefined(UpdateStrategyId)) + { + writer.WritePropertyName("updateStrategyId"u8); + writer.WriteStringValue(UpdateStrategyId); + } + if (Optional.IsDefined(Strategy)) + { + writer.WritePropertyName("strategy"u8); + writer.WriteObjectValue(Strategy, options); + } + if (Optional.IsDefined(ManagedClusterUpdate)) + { + writer.WritePropertyName("managedClusterUpdate"u8); + writer.WriteObjectValue(ManagedClusterUpdate, options); + } + if (options.Format != "W" && Optional.IsDefined(Status)) { - writer.WriteStringValue(item); + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); } - writer.WriteEndArray(); writer.WriteEndObject(); } - ContainerServiceTrustedAccessRoleBindingData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + UpdateRunData 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(ContainerServiceTrustedAccessRoleBindingData)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(UpdateRunData)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement, options); + return DeserializeUpdateRunData(document.RootElement, options); } - internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContainerServiceTrustedAccessRoleBindingData(JsonElement element, ModelReaderWriterOptions options = null) + internal static UpdateRunData DeserializeUpdateRunData(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -78,17 +93,29 @@ internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContaine { return null; } + ETag? etag = default; ResourceIdentifier id = default; string name = default; ResourceType type = default; SystemData systemData = default; - ContainerServiceTrustedAccessRoleBindingProvisioningState? provisioningState = default; - ResourceIdentifier sourceResourceId = default; - IList roles = default; + UpdateRunProvisioningState? provisioningState = default; + ResourceIdentifier updateStrategyId = default; + UpdateRunStrategy strategy = default; + ManagedClusterUpdate managedClusterUpdate = default; + UpdateRunStatus 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("id"u8)) { id = new ResourceIdentifier(property.Value.GetString()); @@ -128,22 +155,43 @@ internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContaine { continue; } - provisioningState = new ContainerServiceTrustedAccessRoleBindingProvisioningState(property0.Value.GetString()); + provisioningState = new UpdateRunProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("updateStrategyId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updateStrategyId = new ResourceIdentifier(property0.Value.GetString()); continue; } - if (property0.NameEquals("sourceResourceId"u8)) + if (property0.NameEquals("strategy"u8)) { - sourceResourceId = new ResourceIdentifier(property0.Value.GetString()); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + strategy = UpdateRunStrategy.DeserializeUpdateRunStrategy(property0.Value, options); continue; } - if (property0.NameEquals("roles"u8)) + if (property0.NameEquals("managedClusterUpdate"u8)) { - List array = new List(); - foreach (var item in property0.Value.EnumerateArray()) + if (property0.Value.ValueKind == JsonValueKind.Null) { - array.Add(item.GetString()); + continue; } - roles = array; + managedClusterUpdate = ManagedClusterUpdate.DeserializeManagedClusterUpdate(property0.Value, options); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = UpdateRunStatus.DeserializeUpdateRunStatus(property0.Value, options); continue; } } @@ -155,14 +203,17 @@ internal static ContainerServiceTrustedAccessRoleBindingData DeserializeContaine } } serializedAdditionalRawData = rawDataDictionary; - return new ContainerServiceTrustedAccessRoleBindingData( + return new UpdateRunData( id, name, type, systemData, + etag, provisioningState, - sourceResourceId, - roles, + updateStrategyId, + strategy, + managedClusterUpdate, + status, serializedAdditionalRawData); } @@ -200,6 +251,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(Id), out propertyOverride); if (hasPropertyOverride) { @@ -247,54 +313,68 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceResourceId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpdateStrategyId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" sourceResourceId: "); + builder.Append(" updateStrategyId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SourceResourceId)) + if (Optional.IsDefined(UpdateStrategyId)) { - builder.Append(" sourceResourceId: "); - builder.AppendLine($"'{SourceResourceId.ToString()}'"); + builder.Append(" updateStrategyId: "); + builder.AppendLine($"'{UpdateStrategyId.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Roles), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("StrategyStages", out propertyOverride); if (hasPropertyOverride) { - builder.Append(" roles: "); + builder.Append(" strategy: "); + builder.AppendLine("{"); + builder.AppendLine(" strategy: {"); + builder.Append(" stages: "); builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); } else { - if (Optional.IsCollectionDefined(Roles)) + if (Optional.IsDefined(Strategy)) { - if (Roles.Any()) - { - builder.Append(" roles: "); - builder.AppendLine("["); - foreach (var item in Roles) - { - if (item == null) - { - builder.Append("null"); - continue; - } - if (item.Contains(Environment.NewLine)) - { - builder.AppendLine(" '''"); - builder.AppendLine($"{item}'''"); - } - else - { - builder.AppendLine($" '{item}'"); - } - } - builder.AppendLine(" ]"); - } + builder.Append(" strategy: "); + BicepSerializationHelpers.AppendChildObject(builder, Strategy, options, 4, false, " strategy: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedClusterUpdate), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedClusterUpdate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagedClusterUpdate)) + { + builder.Append(" managedClusterUpdate: "); + BicepSerializationHelpers.AppendChildObject(builder, ManagedClusterUpdate, options, 4, false, " managedClusterUpdate: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + BicepSerializationHelpers.AppendChildObject(builder, Status, options, 4, false, " status: "); } } @@ -303,9 +383,9 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) 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) { @@ -314,26 +394,26 @@ BinaryData IPersistableModel.Write case "bicep": return SerializeBicep(options); default: - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRoleBindingData)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunData)} does not support writing '{options.Format}' format."); } } - ContainerServiceTrustedAccessRoleBindingData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + UpdateRunData 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); - return DeserializeContainerServiceTrustedAccessRoleBindingData(document.RootElement, options); + return DeserializeUpdateRunData(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(ContainerServiceTrustedAccessRoleBindingData)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(UpdateRunData)} 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/UpdateRunData.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.cs new file mode 100644 index 000000000000..da9514405ecf --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunData.cs @@ -0,0 +1,142 @@ +// 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 UpdateRun data model. + /// A multi-stage process to perform update operations across members of a Fleet. + /// + public partial class UpdateRunData : 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 UpdateRunData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + /// The provisioning state of the UpdateRun resource. + /// + /// The resource id of the FleetUpdateStrategy resource to reference. + /// + /// When creating a new run, there are three ways to define a strategy for the run: + /// 1. Define a new strategy in place: Set the "strategy" field. + /// 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + /// 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + /// + /// Setting both "updateStrategyId" and "strategy" is invalid. + /// + /// UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in the "strategy" field. + /// Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + /// UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun. + /// + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + /// The status of the UpdateRun. + /// Keeps track of any properties unknown to the library. + internal UpdateRunData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ETag? etag, UpdateRunProvisioningState? provisioningState, ResourceIdentifier updateStrategyId, UpdateRunStrategy strategy, ManagedClusterUpdate managedClusterUpdate, UpdateRunStatus status, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ETag = etag; + ProvisioningState = provisioningState; + UpdateStrategyId = updateStrategyId; + Strategy = strategy; + ManagedClusterUpdate = managedClusterUpdate; + Status = status; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// If eTag is provided in the response body, it may also be provided as a header per the normal etag convention. Entity tags are used for comparing two or more entities from the same requested resource. HTTP/1.1 uses entity tags in the etag (section 14.19), If-Match (section 14.24), If-None-Match (section 14.26), and If-Range (section 14.27) header fields. + [WirePath("eTag")] + public ETag? ETag { get; } + /// The provisioning state of the UpdateRun resource. + [WirePath("properties.provisioningState")] + public UpdateRunProvisioningState? ProvisioningState { get; } + /// + /// The resource id of the FleetUpdateStrategy resource to reference. + /// + /// When creating a new run, there are three ways to define a strategy for the run: + /// 1. Define a new strategy in place: Set the "strategy" field. + /// 2. Use an existing strategy: Set the "updateStrategyId" field. (since 2023-08-15-preview) + /// 3. Use the default strategy to update all the members one by one: Leave both "updateStrategyId" and "strategy" unset. (since 2023-08-15-preview) + /// + /// Setting both "updateStrategyId" and "strategy" is invalid. + /// + /// UpdateRuns created by "updateStrategyId" snapshot the referenced UpdateStrategy at the time of creation and store it in the "strategy" field. + /// Subsequent changes to the referenced FleetUpdateStrategy resource do not propagate. + /// UpdateRunStrategy changes can be made directly on the "strategy" field before launching the UpdateRun. + /// + [WirePath("properties.updateStrategyId")] + public ResourceIdentifier UpdateStrategyId { get; set; } + /// + /// The strategy defines the order in which the clusters will be updated. + /// If not set, all members will be updated sequentially. The UpdateRun status will show a single UpdateStage and a single UpdateGroup targeting all members. + /// The strategy of the UpdateRun can be modified until the run is started. + /// + internal UpdateRunStrategy Strategy { get; set; } + /// The list of stages that compose this update run. Min size: 1. + [WirePath("properties.strategy.stages")] + public IList StrategyStages + { + get => Strategy is null ? default : Strategy.Stages; + set => Strategy = new UpdateRunStrategy(value); + } + + /// The update to be applied to all clusters in the UpdateRun. The managedClusterUpdate can be modified until the run is started. + [WirePath("properties.managedClusterUpdate")] + public ManagedClusterUpdate ManagedClusterUpdate { get; set; } + /// The status of the UpdateRun. + [WirePath("properties.status")] + public UpdateRunStatus Status { get; } + } +} diff --git a/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.Serialization.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.Serialization.cs new file mode 100644 index 000000000000..78c846f8a361 --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.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 UpdateRunResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + UpdateRunData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + UpdateRunData 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/UpdateRunResource.cs b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.cs new file mode 100644 index 000000000000..ed05a066290f --- /dev/null +++ b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/Generated/UpdateRunResource.cs @@ -0,0 +1,620 @@ +// 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.ContainerService.Models; + +namespace Azure.ResourceManager.ContainerService +{ + /// + /// A Class representing an UpdateRun 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 GetUpdateRunResource method. + /// Otherwise you can get one from its parent resource using the GetUpdateRun method. + /// + public partial class UpdateRunResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The fleetName. + /// The updateRunName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string fleetName, string updateRunName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _updateRunClientDiagnostics; + private readonly UpdateRunsRestOperations _updateRunRestClient; + private readonly UpdateRunData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ContainerService/fleets/updateRuns"; + + /// Initializes a new instance of the class for mocking. + protected UpdateRunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal UpdateRunResource(ArmClient client, UpdateRunData 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 UpdateRunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _updateRunClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ContainerService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string updateRunApiVersion); + _updateRunRestClient = new UpdateRunsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, updateRunApiVersion); +#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 UpdateRunData 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 UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Get"); + scope.Start(); + try + { + var response = await _updateRunRestClient.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 UpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Get + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Get"); + scope.Start(); + try + { + var response = _updateRunRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new UpdateRunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Delete"); + scope.Start(); + try + { + var response = await _updateRunRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(_updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_Delete + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Delete"); + scope.Start(); + try + { + var response = _updateRunRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(_updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// Resource create parameters. + /// 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, UpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Update"); + scope.Start(); + try + { + var response = await _updateRunRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a UpdateRun + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName} + /// + /// + /// Operation Id + /// UpdateRuns_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// Resource create parameters. + /// 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, UpdateRunData data, string ifMatch = null, string ifNoneMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Update"); + scope.Start(); + try + { + var response = _updateRunRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, ifMatch, ifNoneMatch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip + /// + /// + /// Operation Id + /// UpdateRuns_Skip + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 content of the action request. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual async Task> SkipAsync(WaitUntil waitUntil, SkipProperties body, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Skip"); + scope.Start(); + try + { + var response = await _updateRunRestClient.SkipAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateSkipRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Skips one or a combination of member/group/stage/afterStageWait(s) of an update run. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/skip + /// + /// + /// Operation Id + /// UpdateRuns_Skip + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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 content of the action request. + /// The request should only proceed if an entity matches this string. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Skip(WaitUntil waitUntil, SkipProperties body, string ifMatch = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Skip"); + scope.Start(); + try + { + var response = _updateRunRestClient.Skip(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateSkipRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, body, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start + /// + /// + /// Operation Id + /// UpdateRuns_Start + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task> StartAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Start"); + scope.Start(); + try + { + var response = await _updateRunRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/start + /// + /// + /// Operation Id + /// UpdateRuns_Start + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Start(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Start"); + scope.Start(); + try + { + var response = _updateRunRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Stops an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop + /// + /// + /// Operation Id + /// UpdateRuns_Stop + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual async Task> StopAsync(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Stop"); + scope.Start(); + try + { + var response = await _updateRunRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken).ConfigureAwait(false); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Stops an UpdateRun. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ContainerService/fleets/{fleetName}/updateRuns/{updateRunName}/stop + /// + /// + /// Operation Id + /// UpdateRuns_Stop + /// + /// + /// Default Api Version + /// 2025-03-01 + /// + /// + /// 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. + /// The cancellation token to use. + public virtual ArmOperation Stop(WaitUntil waitUntil, string ifMatch = null, CancellationToken cancellationToken = default) + { + using var scope = _updateRunClientDiagnostics.CreateScope("UpdateRunResource.Stop"); + scope.Start(); + try + { + var response = _updateRunRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch, cancellationToken); + var operation = new ContainerServiceArmOperation(new UpdateRunOperationSource(Client), _updateRunClientDiagnostics, Pipeline, _updateRunRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, ifMatch).Request, response, OperationFinalStateVia.Location); + 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/autorest.md b/sdk/containerservice/Azure.ResourceManager.ContainerService/src/autorest.md index c904c624099b..9ef6441efa3d 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/fleet/readme.md #tag: package-2023-10 output-folder: $(this-folder)/Generated clear-output-folder: true diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..f28c28a5d39c 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -79,7 +79,6 @@ trigger: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -108,6 +107,7 @@ trigger: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto @@ -285,7 +285,6 @@ pr: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -314,6 +313,7 @@ pr: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto