From 6780f1f235e99f13c5ce0c9da0c1dc78dd010be2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 18 Mar 2025 07:34:18 +0000 Subject: [PATCH] CodeGen from PR 3638 in test-repo-billy/azure-rest-api-specs Merge f14c57007b0af48c4c63a0d3ea823db7d7273b7b into 2b2e803b5aa04ba3b98ca563f7ac5ac576a0fe0e --- .../Azure.ResourceManager.Contoso.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../Azure.ResourceManager.Contoso/README.md | 80 + .../Azure.ResourceManager.Contoso.net8.0.cs | 131 ++ ....ResourceManager.Contoso.netstandard2.0.cs | 131 ++ .../Azure.ResourceManager.Contoso/assets.json | 7 + ...ure.ResourceManager.Contoso.Samples.csproj | 13 + .../Samples/Sample_EmployeeCollection.cs | 206 +++ .../Samples/Sample_EmployeeResource.cs | 119 ++ .../Sample_SubscriptionResourceExtensions.cs | 50 + .../src/Azure.ResourceManager.Contoso.csproj | 8 + .../src/Generated/ArmContosoModelFactory.cs | 54 + .../src/Generated/EmployeeCollection.cs | 494 ++++++ .../Generated/EmployeeData.Serialization.cs | 178 +++ .../src/Generated/EmployeeData.cs | 83 + .../EmployeeResource.Serialization.cs | 26 + .../src/Generated/EmployeeResource.cs | 698 ++++++++ .../Generated/Extensions/ContosoExtensions.cs | 219 +++ .../Extensions/MockableContosoArmClient.cs | 49 + .../MockableContosoResourceGroupResource.cs | 105 ++ .../MockableContosoSubscriptionResource.cs | 102 ++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 ++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++ .../Internal/ModelSerializationExtensions.cs | 399 +++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../ContosoArmOperation.cs | 94 ++ .../ContosoArmOperationOfT.cs | 100 ++ .../EmployeeOperationSource.cs | 36 + .../EmployeeListResult.Serialization.cs | 151 ++ .../Generated/Models/EmployeeListResult.cs | 80 + .../EmployeeProperties.Serialization.cs | 174 ++ .../Generated/Models/EmployeeProperties.cs | 77 + .../src/Generated/Models/ProvisioningState.cs | 66 + .../src/Generated/ProviderConstants.cs | 16 + .../RestOperations/EmployeesRestOperations.cs | 731 +++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...Azure.ResourceManager.Contoso.Tests.csproj | 8 + .../tests/ContosoManagementTestBase.cs | 45 + .../tests/ContosoManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/contoso/ci.mgmt.yml | 26 + .../Azure.Template.Contoso.sln | 56 + .../Azure.Template.Contoso/CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../Azure.Template.Contoso/README.md | 107 ++ .../api/Azure.Template.Contoso.net8.0.cs | 115 ++ .../Azure.Template.Contoso.netstandard2.0.cs | 115 ++ .../src/Azure.Template.Contoso.csproj | 19 + .../src/Generated/ContosoWidgets.cs | 661 ++++++++ .../src/Generated/Docs/ContosoWidgets.xml | 273 ++++ .../FakedSharedModel.Serialization.cs} | 104 +- .../src/Generated/FakedSharedModel.cs | 81 + .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 ++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++ .../Internal/ModelSerializationExtensions.cs | 399 +++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../src/Generated/OperationState.cs | 60 + ...dgetSuiteWidgetSuiteError.Serialization.cs | 180 +++ ...rationStatusWidgetSuiteWidgetSuiteError.cs | 89 ++ .../TemplateContosoClientBuilderExtensions.cs | 35 + .../Generated/TemplateContosoModelFactory.cs | 38 + .../src/Generated/WidgetManagerClient.cs | 69 + .../Generated/WidgetManagerClientOptions.cs | 37 + .../Generated/WidgetSuite.Serialization.cs} | 79 +- .../src/Generated/WidgetSuite.cs | 83 + .../src/Properties/AssemblyInfo.cs | 11 + .../tests/Azure.Template.Contoso.Tests.csproj | 20 + .../Samples/Samples_ContosoWidgets.cs | 287 ++++ .../Azure.Template.Contoso/tsp-location.yaml | 5 + sdk/contosowidgetmanager/ci.yml | 35 + .../Azure.ResourceManager.Fabric.net8.0.cs | 32 + ...e.ResourceManager.Fabric.netstandard2.0.cs | 32 + .../Sample_FabricCapacityCollection.cs | 10 +- .../Samples/Sample_FabricCapacityResource.cs | 12 +- .../Sample_SubscriptionResourceExtensions.cs | 34 +- .../src/Generated/ArmFabricModelFactory.cs | 20 + .../Generated/Extensions/FabricExtensions.cs | 92 +- .../MockableFabricResourceGroupResource.cs | 4 +- .../MockableFabricSubscriptionResource.cs | 82 +- .../src/Generated/FabricCapacityCollection.cs | 20 +- .../src/Generated/FabricCapacityResource.cs | 36 +- .../Models/FabricQuota.Serialization.cs | 157 ++ .../src/Generated/Models/FabricQuota.cs | 91 ++ .../Models/PagedQuota.Serialization.cs | 151 ++ .../src/Generated/Models/PagedQuota.cs | 80 + .../Models/QuotaName.Serialization.cs | 140 ++ .../src/Generated/Models/QuotaName.cs | 69 + .../FabricCapacitiesRestOperations.cs | 168 +- .../tsp-location.yaml | 5 +- .../src/Generated/AIVisionFaceModelFactory.cs | 288 ++-- .../Generated/AuditLivenessResponseInfo.cs | 87 - .../src/Generated/AuditRequestInfo.cs | 97 -- .../AzureAIVisionFaceClientOptions.cs | 5 +- ...ateLivenessSessionContent.Serialization.cs | 30 +- .../Generated/CreateLivenessSessionContent.cs | 12 +- .../Generated/CreateLivenessSessionResult.cs | 82 - ...sWithVerifySessionContent.Serialization.cs | 102 +- .../CreateLivenessWithVerifySessionContent.cs | 30 +- ...fySessionMultipartContent.Serialization.cs | 183 --- ...venessWithVerifySessionMultipartContent.cs | 83 - .../CreateLivenessWithVerifySessionResult.cs | 86 - .../src/Generated/Docs/FaceSessionClient.xml | 316 +--- .../src/Generated/FaceSessionClient.cs | 935 ++--------- .../src/Generated/FaceSessionStatus.cs | 54 - .../src/Generated/LargeFaceListClient.cs | 2 +- .../src/Generated/LargePersonGroupClient.cs | 2 +- ...enessColorDecisionTarget.Serialization.cs} | 60 +- ...rget.cs => LivenessColorDecisionTarget.cs} | 37 +- .../LivenessDecisionTargets.Serialization.cs | 142 ++ .../src/Generated/LivenessDecisionTargets.cs | 75 + ...tion.cs => LivenessError.Serialization.cs} | 72 +- .../src/Generated/LivenessError.cs | 89 ++ .../src/Generated/LivenessModel.cs | 9 +- .../LivenessResponseBody.Serialization.cs | 188 --- .../src/Generated/LivenessResponseBody.cs | 77 - ...ion.cs => LivenessResult.Serialization.cs} | 92 +- .../src/Generated/LivenessResult.cs | 90 ++ .../LivenessSession.Serialization.cs | 100 +- .../src/Generated/LivenessSession.cs | 60 +- .../LivenessSessionAttempt.Serialization.cs | 180 +++ .../src/Generated/LivenessSessionAttempt.cs | 86 + .../Generated/LivenessSessionAuditEntry.cs | 130 -- .../src/Generated/LivenessSessionItem.cs | 94 -- .../LivenessSessionResults.Serialization.cs | 152 ++ .../src/Generated/LivenessSessionResults.cs | 76 + ...LivenessWithVerifyOutputs.Serialization.cs | 10 +- .../Generated/LivenessWithVerifyOutputs.cs | 13 +- ...enessWithVerifyReference.Serialization.cs} | 50 +- ...mage.cs => LivenessWithVerifyReference.cs} | 20 +- ...LivenessWithVerifyResult.Serialization.cs} | 134 +- .../src/Generated/LivenessWithVerifyResult.cs | 98 ++ ...LivenessWithVerifySession.Serialization.cs | 100 +- .../Generated/LivenessWithVerifySession.cs | 60 +- ...WithVerifySessionAttempt.Serialization.cs} | 115 +- .../LivenessWithVerifySessionAttempt.cs | 86 + ...sWithVerifySessionResults.Serialization.cs | 170 ++ .../LivenessWithVerifySessionResults.cs | 83 + .../src/Generated/OperationState.cs | 60 + .../Samples/Samples_FaceSessionClient.cs | 308 +--- .../Azure.AI.Vision.Face/tsp-location.yaml | 7 +- sdk/resourcemanager/ci.mgmt.yml | 6 +- .../api/Azure.ResourceManager.Sql.net8.0.cs | 468 +++++- ...zure.ResourceManager.Sql.netstandard2.0.cs | 468 +++++- ..._DistributedAvailabilityGroupCollection.cs | 78 +- ...le_DistributedAvailabilityGroupResource.cs | 78 +- .../Samples/Sample_InstancePoolResource.cs | 8 +- .../Sample_ManagedInstanceCollection.cs | 143 +- .../Samples/Sample_ManagedInstanceResource.cs | 122 +- .../Sample_SubscriptionResourceExtensions.cs | 72 +- .../src/Generated/ArmSqlModelFactory.cs | 1408 +++++++++-------- .../DistributedAvailabilityGroupCollection.cs | 20 +- ...utedAvailabilityGroupData.Serialization.cs | 356 +++-- .../DistributedAvailabilityGroupData.cs | 102 +- .../DistributedAvailabilityGroupResource.cs | 197 ++- .../Extensions/MockableSqlArmClient.cs | 48 +- .../MockableSqlResourceGroupResource.cs | 142 +- .../MockableSqlSubscriptionResource.cs | 132 +- .../src/Generated/Extensions/SqlExtensions.cs | 406 ++--- .../src/Generated/InstancePoolResource.cs | 4 +- ...eStatusOperationResultMIOperationSource.cs | 30 + .../Generated/ManagedInstanceCollection.cs | 20 +- .../ManagedInstanceData.Serialization.cs | 351 +++- .../src/Generated/ManagedInstanceData.cs | 63 +- .../src/Generated/ManagedInstanceResource.cs | 290 ++-- .../Models/AuthMetadataLookupMode.cs | 54 + .../Models/CertificateInfo.Serialization.cs | 201 +++ .../src/Generated/Models/CertificateInfo.cs | 71 + ...AvailabilityGroupDatabase.Serialization.cs | 829 ++++++++++ .../DistributedAvailabilityGroupDatabase.cs | 166 ++ ...ributedAvailabilityGroupReplicationMode.cs | 51 - ...dAvailabilityGroupSetRole.Serialization.cs | 134 ++ .../DistributedAvailabilityGroupSetRole.cs | 80 + ...lityGroupsFailoverContent.Serialization.cs | 126 ++ ...ibutedAvailabilityGroupsFailoverContent.cs | 73 + .../src/Generated/Models/FailoverModeType.cs | 51 + .../src/Generated/Models/FailoverType.cs | 51 + .../src/Generated/Models/FreemiumType.cs | 51 + .../Generated/Models/HybridSecondaryUsage.cs | 51 + .../Models/HybridSecondaryUsageDetected.cs | 51 + .../src/Generated/Models/InstanceRole.cs | 51 + .../src/Generated/Models/LinkRole.cs | 51 + .../Models/ManagedInstanceDatabaseFormat.cs | 51 + .../ManagedInstancePatch.Serialization.cs | 176 ++- .../Generated/Models/ManagedInstancePatch.cs | 63 +- ...agedInstancePropertiesProvisioningState.cs | 90 -- ...tricIntervalAutoGenerated.Serialization.cs | 279 ++++ .../QueryMetricIntervalAutoGenerated.cs | 82 + ...QueryStatisticsProperties.Serialization.cs | 8 +- .../Models/QueryStatisticsProperties.cs | 6 +- ...ceStatusOperationResultMI.Serialization.cs | 433 +++++ ...ternalGovernanceStatusOperationResultMI.cs | 97 ++ .../Generated/Models/ReplicaConnectedState.cs | 51 + .../Models/ReplicaSynchronizationHealth.cs | 54 + .../Generated/Models/ReplicationModeType.cs | 51 + .../src/Generated/Models/RoleChangeType.cs | 51 + .../src/Generated/Models/SeedingModeType.cs | 51 + ...ributedAvailabilityGroupsRestOperations.cs | 207 ++- .../ManagedInstancesRestOperations.cs | 94 +- .../Azure.ResourceManager.Sql/src/autorest.md | 2 +- sdk/storage/ci.yml | 8 + 205 files changed, 19550 insertions(+), 5150 deletions(-) create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/Azure.ResourceManager.Contoso.sln create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/CHANGELOG.md create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/Directory.Build.props create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/README.md create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.net8.0.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.netstandard2.0.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/assets.json create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/samples/Azure.ResourceManager.Contoso.Samples.csproj create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeCollection.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeResource.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Azure.ResourceManager.Contoso.csproj create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ArmContosoModelFactory.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeCollection.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.Serialization.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.Serialization.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/ContosoExtensions.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoArmClient.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoResourceGroupResource.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoSubscriptionResource.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Argument.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Optional.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperation.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperationOfT.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/EmployeeOperationSource.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.Serialization.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.Serialization.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ProviderConstants.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/RestOperations/EmployeesRestOperations.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/src/Properties/AssemblyInfo.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/tests/Azure.ResourceManager.Contoso.Tests.csproj create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestBase.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestEnvironment.cs create mode 100644 sdk/contoso/Azure.ResourceManager.Contoso/tsp-location.yaml create mode 100644 sdk/contoso/ci.mgmt.yml create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/README.md create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml rename sdk/{face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs => contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs} (55%) create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs rename sdk/{face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs => contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs} (55%) create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs create mode 100644 sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml create mode 100644 sdk/contosowidgetmanager/ci.yml create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.Serialization.cs create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.cs create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.Serialization.cs create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.cs create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.Serialization.cs create mode 100644 sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{CreateLivenessSessionResult.Serialization.cs => LivenessColorDecisionTarget.Serialization.cs} (65%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessOutputsTarget.cs => LivenessColorDecisionTarget.cs} (51%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{AuditLivenessResponseInfo.Serialization.cs => LivenessError.Serialization.cs} (57%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessOutputsTarget.Serialization.cs => LivenessResult.Serialization.cs} (55%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs delete mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessWithVerifyImage.Serialization.cs => LivenessWithVerifyReference.Serialization.cs} (65%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessWithVerifyImage.cs => LivenessWithVerifyReference.cs} (73%) rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessSessionAuditEntry.Serialization.cs => LivenessWithVerifyResult.Serialization.cs} (55%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs rename sdk/face/Azure.AI.Vision.Face/src/Generated/{LivenessSessionItem.Serialization.cs => LivenessWithVerifySessionAttempt.Serialization.cs} (51%) create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs create mode 100644 sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/RefreshExternalGovernanceStatusOperationResultMIOperationSource.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthMetadataLookupMode.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupReplicationMode.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverModeType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FreemiumType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsage.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsageDetected.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstanceRole.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LinkRole.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDatabaseFormat.cs delete mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.Serialization.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaConnectedState.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaSynchronizationHealth.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationModeType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RoleChangeType.cs create mode 100644 sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SeedingModeType.cs diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/Azure.ResourceManager.Contoso.sln b/sdk/contoso/Azure.ResourceManager.Contoso/Azure.ResourceManager.Contoso.sln new file mode 100644 index 000000000000..cb820959e5b2 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/Azure.ResourceManager.Contoso.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Contoso.Samples", "samples\Azure.ResourceManager.Contoso.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Contoso", "src\Azure.ResourceManager.Contoso.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Contoso.Tests", "tests\Azure.ResourceManager.Contoso.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/CHANGELOG.md b/sdk/contoso/Azure.ResourceManager.Contoso/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/Directory.Build.props b/sdk/contoso/Azure.ResourceManager.Contoso/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/README.md b/sdk/contoso/Azure.ResourceManager.Contoso/README.md new file mode 100644 index 000000000000..78ea67f6bbf0 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Contoso management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure Contoso management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Contoso --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.net8.0.cs b/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.net8.0.cs new file mode 100644 index 000000000000..e066d059b9ab --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.net8.0.cs @@ -0,0 +1,131 @@ +namespace Azure.ResourceManager.Contoso +{ + public static partial class ContosoExtensions + { + public static Azure.Response GetEmployee(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetEmployeeAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Contoso.EmployeeResource GetEmployeeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Contoso.EmployeeCollection GetEmployees(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetEmployees(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetEmployeesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class EmployeeCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected EmployeeCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string employeeName, Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string employeeName, Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class EmployeeData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EmployeeData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Contoso.Models.EmployeeProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EmployeeResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected EmployeeResource() { } + public virtual Azure.ResourceManager.Contoso.EmployeeData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string employeeName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Contoso.Mocking +{ + public partial class MockableContosoArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContosoArmClient() { } + public virtual Azure.ResourceManager.Contoso.EmployeeResource GetEmployeeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContosoResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContosoResourceGroupResource() { } + public virtual Azure.Response GetEmployee(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEmployeeAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Contoso.EmployeeCollection GetEmployees() { throw null; } + } + public partial class MockableContosoSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContosoSubscriptionResource() { } + public virtual Azure.Pageable GetEmployees(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEmployeesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Contoso.Models +{ + public static partial class ArmContosoModelFactory + { + public static Azure.ResourceManager.Contoso.EmployeeData EmployeeData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Contoso.Models.EmployeeProperties properties = null) { throw null; } + public static Azure.ResourceManager.Contoso.Models.EmployeeProperties EmployeeProperties(int? age = default(int?), string city = null, byte[] profile = null, Azure.ResourceManager.Contoso.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Contoso.Models.ProvisioningState?)) { throw null; } + } + public partial class EmployeeProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EmployeeProperties() { } + public int? Age { get { throw null; } set { } } + public string City { get { throw null; } set { } } + public byte[] Profile { get { throw null; } set { } } + public Azure.ResourceManager.Contoso.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.Models.EmployeeProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.Models.EmployeeProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Contoso.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Contoso.Models.ProvisioningState left, Azure.ResourceManager.Contoso.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Contoso.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Contoso.Models.ProvisioningState left, Azure.ResourceManager.Contoso.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.netstandard2.0.cs b/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.netstandard2.0.cs new file mode 100644 index 000000000000..e066d059b9ab --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/api/Azure.ResourceManager.Contoso.netstandard2.0.cs @@ -0,0 +1,131 @@ +namespace Azure.ResourceManager.Contoso +{ + public static partial class ContosoExtensions + { + public static Azure.Response GetEmployee(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetEmployeeAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Contoso.EmployeeResource GetEmployeeResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Contoso.EmployeeCollection GetEmployees(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetEmployees(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetEmployeesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class EmployeeCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected EmployeeCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string employeeName, Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string employeeName, Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class EmployeeData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EmployeeData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Contoso.Models.EmployeeProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class EmployeeResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected EmployeeResource() { } + public virtual Azure.ResourceManager.Contoso.EmployeeData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string employeeName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.EmployeeData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Contoso.EmployeeData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Contoso.Mocking +{ + public partial class MockableContosoArmClient : Azure.ResourceManager.ArmResource + { + protected MockableContosoArmClient() { } + public virtual Azure.ResourceManager.Contoso.EmployeeResource GetEmployeeResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableContosoResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableContosoResourceGroupResource() { } + public virtual Azure.Response GetEmployee(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetEmployeeAsync(string employeeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Contoso.EmployeeCollection GetEmployees() { throw null; } + } + public partial class MockableContosoSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableContosoSubscriptionResource() { } + public virtual Azure.Pageable GetEmployees(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetEmployeesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Contoso.Models +{ + public static partial class ArmContosoModelFactory + { + public static Azure.ResourceManager.Contoso.EmployeeData EmployeeData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Contoso.Models.EmployeeProperties properties = null) { throw null; } + public static Azure.ResourceManager.Contoso.Models.EmployeeProperties EmployeeProperties(int? age = default(int?), string city = null, byte[] profile = null, Azure.ResourceManager.Contoso.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Contoso.Models.ProvisioningState?)) { throw null; } + } + public partial class EmployeeProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public EmployeeProperties() { } + public int? Age { get { throw null; } set { } } + public string City { get { throw null; } set { } } + public byte[] Profile { get { throw null; } set { } } + public Azure.ResourceManager.Contoso.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.Models.EmployeeProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Contoso.Models.EmployeeProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Contoso.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Contoso.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Contoso.Models.ProvisioningState left, Azure.ResourceManager.Contoso.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Contoso.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Contoso.Models.ProvisioningState left, Azure.ResourceManager.Contoso.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/assets.json b/sdk/contoso/Azure.ResourceManager.Contoso/assets.json new file mode 100644 index 000000000000..ed7bbd7af63d --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/contoso/Azure.ResourceManager.Contoso", + "Tag": "" +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/samples/Azure.ResourceManager.Contoso.Samples.csproj b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Azure.ResourceManager.Contoso.Samples.csproj new file mode 100644 index 000000000000..e1423e416b0f --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Azure.ResourceManager.Contoso.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeCollection.cs b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeCollection.cs new file mode 100644 index 000000000000..5d6930e24057 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Contoso.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Contoso.Samples +{ + public partial class Sample_EmployeeCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_EmployeesCreateOrUpdate() + { + // Generated from example definition: 2021-11-01/Employees_CreateOrUpdate.json + // this example is just showing the usage of "Employee_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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmployeeResource + EmployeeCollection collection = resourceGroupResource.GetEmployees(); + + // invoke the operation + string employeeName = "9KF-f-8b"; + EmployeeData data = new EmployeeData(new AzureLocation("itajgxyqozseoygnl")) + { + Properties = new EmployeeProperties + { + Age = 30, + City = "gydhnntudughbmxlkyzrskcdkotrxn", + Profile = Encoding.UTF8.GetBytes("ms"), + }, + Tags = +{ +["key2913"] = "urperxmkkhhkp" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, employeeName, data); + EmployeeResource 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 + EmployeeData 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_EmployeesGet() + { + // Generated from example definition: 2021-11-01/Employees_Get.json + // this example is just showing the usage of "Employee_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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmployeeResource + EmployeeCollection collection = resourceGroupResource.GetEmployees(); + + // invoke the operation + string employeeName = "le-8MU--J3W6q8D386p3-iT3"; + EmployeeResource result = await collection.GetAsync(employeeName); + + // 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 + EmployeeData 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_EmployeesListByResourceGroup() + { + // Generated from example definition: 2021-11-01/Employees_ListByResourceGroup.json + // this example is just showing the usage of "Employee_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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmployeeResource + EmployeeCollection collection = resourceGroupResource.GetEmployees(); + + // invoke the operation and iterate over the result + await foreach (EmployeeResource 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 + EmployeeData 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_EmployeesGet() + { + // Generated from example definition: 2021-11-01/Employees_Get.json + // this example is just showing the usage of "Employee_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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmployeeResource + EmployeeCollection collection = resourceGroupResource.GetEmployees(); + + // invoke the operation + string employeeName = "le-8MU--J3W6q8D386p3-iT3"; + bool result = await collection.ExistsAsync(employeeName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_EmployeesGet() + { + // Generated from example definition: 2021-11-01/Employees_Get.json + // this example is just showing the usage of "Employee_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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this EmployeeResource + EmployeeCollection collection = resourceGroupResource.GetEmployees(); + + // invoke the operation + string employeeName = "le-8MU--J3W6q8D386p3-iT3"; + NullableResponse response = await collection.GetIfExistsAsync(employeeName); + EmployeeResource 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 + EmployeeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeResource.cs b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeResource.cs new file mode 100644 index 000000000000..da147009f1d0 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_EmployeeResource.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Contoso.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Contoso.Samples +{ + public partial class Sample_EmployeeResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_EmployeesGet() + { + // Generated from example definition: 2021-11-01/Employees_Get.json + // this example is just showing the usage of "Employee_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 EmployeeResource created on azure + // for more information of creating EmployeeResource, please refer to the document of EmployeeResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + string employeeName = "le-8MU--J3W6q8D386p3-iT3"; + ResourceIdentifier employeeResourceId = EmployeeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, employeeName); + EmployeeResource employee = client.GetEmployeeResource(employeeResourceId); + + // invoke the operation + EmployeeResource result = await employee.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 + EmployeeData 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_EmployeesDelete() + { + // Generated from example definition: 2021-11-01/Employees_Delete.json + // this example is just showing the usage of "Employee_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 EmployeeResource created on azure + // for more information of creating EmployeeResource, please refer to the document of EmployeeResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + string employeeName = "5vX--BxSu3ux48rI4O9OQ569"; + ResourceIdentifier employeeResourceId = EmployeeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, employeeName); + EmployeeResource employee = client.GetEmployeeResource(employeeResourceId); + + // invoke the operation + await employee.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_EmployeesUpdate() + { + // Generated from example definition: 2021-11-01/Employees_Update.json + // this example is just showing the usage of "Employee_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 EmployeeResource created on azure + // for more information of creating EmployeeResource, please refer to the document of EmployeeResource + string subscriptionId = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + string resourceGroupName = "rgopenapi"; + string employeeName = "-XhyNJ--"; + ResourceIdentifier employeeResourceId = EmployeeResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, employeeName); + EmployeeResource employee = client.GetEmployeeResource(employeeResourceId); + + // invoke the operation + EmployeeData data = new EmployeeData(default) + { + Properties = new EmployeeProperties + { + Age = 24, + City = "uyfg", + Profile = Encoding.UTF8.GetBytes("oapgijcswfkruiuuzbwco"), + }, + Tags = +{ +["key7952"] = "no" +}, + }; + EmployeeResource result = await employee.UpdateAsync(data); + + // 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 + EmployeeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..62db2b6f5e75 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Contoso.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetEmployees_EmployeesListBySubscription() + { + // Generated from example definition: 2021-11-01/Employees_ListBySubscription.json + // this example is just showing the usage of "Employee_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(); + // 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 = "11809CA1-E126-4017-945E-AA795CD5C5A9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (EmployeeResource item in subscriptionResource.GetEmployeesAsync()) + { + // 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 + EmployeeData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Azure.ResourceManager.Contoso.csproj b/sdk/contoso/Azure.ResourceManager.Contoso/src/Azure.ResourceManager.Contoso.csproj new file mode 100644 index 000000000000..2755628805d0 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Azure.ResourceManager.Contoso.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider Contoso. + 1.0.0-beta.1 + azure;management;arm;resource manager;contoso + Azure.ResourceManager.Contoso + + diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ArmContosoModelFactory.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ArmContosoModelFactory.cs new file mode 100644 index 000000000000..836b121b3967 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ArmContosoModelFactory.cs @@ -0,0 +1,54 @@ +// 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.Models; + +namespace Azure.ResourceManager.Contoso.Models +{ + /// Model factory for models. + public static partial class ArmContosoModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static EmployeeData EmployeeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, EmployeeProperties properties = null) + { + tags ??= new Dictionary(); + + return new EmployeeData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Age of employee. + /// City of employee. + /// Profile of employee. + /// The status of the last operation. + /// A new instance for mocking. + public static EmployeeProperties EmployeeProperties(int? age = null, string city = null, byte[] profile = null, ProvisioningState? provisioningState = null) + { + return new EmployeeProperties(age, city, profile, provisioningState, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeCollection.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeCollection.cs new file mode 100644 index 000000000000..6fead5174202 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeCollection.cs @@ -0,0 +1,494 @@ +// 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.Contoso +{ + /// + /// 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 GetEmployees method from an instance of . + /// + public partial class EmployeeCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _employeeClientDiagnostics; + private readonly EmployeesRestOperations _employeeRestClient; + + /// Initializes a new instance of the class for mocking. + protected EmployeeCollection() + { + } + + /// 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 EmployeeCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _employeeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Contoso", EmployeeResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(EmployeeResource.ResourceType, out string employeeApiVersion); + _employeeRestClient = new EmployeesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, employeeApiVersion); +#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)); + } + + /// + /// Create a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2021-11-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 Employee. + /// Resource create parameters. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _employeeRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, employeeName, data, cancellationToken).ConfigureAwait(false); + var operation = new ContosoArmOperation(new EmployeeOperationSource(Client), _employeeClientDiagnostics, Pipeline, _employeeRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, employeeName, data).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 Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2021-11-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 Employee. + /// Resource create parameters. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _employeeRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, employeeName, data, cancellationToken); + var operation = new ContosoArmOperation(new EmployeeOperationSource(Client), _employeeClientDiagnostics, Pipeline, _employeeRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, employeeName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.Get"); + scope.Start(); + try + { + var response = await _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, employeeName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.Get"); + scope.Start(); + try + { + var response = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, employeeName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Employee resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2021-11-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) => _employeeRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _employeeRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmployeeResource(Client, EmployeeData.DeserializeEmployeeData(e)), _employeeClientDiagnostics, Pipeline, "EmployeeCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Employee resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2021-11-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) => _employeeRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _employeeRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmployeeResource(Client, EmployeeData.DeserializeEmployeeData(e)), _employeeClientDiagnostics, Pipeline, "EmployeeCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.Exists"); + scope.Start(); + try + { + var response = await _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, employeeName, 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.Exists"); + scope.Start(); + try + { + var response = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, employeeName, 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, employeeName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeCollection.GetIfExists"); + scope.Start(); + try + { + var response = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, employeeName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(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/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.Serialization.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.Serialization.cs new file mode 100644 index 000000000000..6f63d6c28ea4 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.Serialization.cs @@ -0,0 +1,178 @@ +// 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; +using Azure.ResourceManager.Contoso.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Contoso +{ + public partial class EmployeeData : 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(EmployeeData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + EmployeeData 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(EmployeeData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEmployeeData(document.RootElement, options); + } + + internal static EmployeeData DeserializeEmployeeData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + EmployeeProperties properties = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = EmployeeProperties.DeserializeEmployeeProperties(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EmployeeData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + 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(EmployeeData)} does not support writing '{options.Format}' format."); + } + } + + EmployeeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeEmployeeData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EmployeeData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.cs new file mode 100644 index 000000000000..081bdf1fe2c7 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeData.cs @@ -0,0 +1,83 @@ +// 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.Contoso.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Contoso +{ + /// + /// A class representing the Employee data model. + /// Employee resource + /// + public partial class EmployeeData : 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 EmployeeData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal EmployeeData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, EmployeeProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmployeeData() + { + } + + /// The resource-specific properties for this resource. + public EmployeeProperties Properties { get; set; } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.Serialization.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.Serialization.cs new file mode 100644 index 000000000000..9ba6d75f170e --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.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.Contoso +{ + public partial class EmployeeResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + EmployeeData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + EmployeeData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.cs new file mode 100644 index 000000000000..d09c19428c4c --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/EmployeeResource.cs @@ -0,0 +1,698 @@ +// 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.Resources; + +namespace Azure.ResourceManager.Contoso +{ + /// + /// A Class representing an Employee 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 GetEmployeeResource method. + /// Otherwise you can get one from its parent resource using the GetEmployee method. + /// + public partial class EmployeeResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The employeeName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string employeeName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _employeeClientDiagnostics; + private readonly EmployeesRestOperations _employeeRestClient; + private readonly EmployeeData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Contoso/employees"; + + /// Initializes a new instance of the class for mocking. + protected EmployeeResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal EmployeeResource(ArmClient client, EmployeeData 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 EmployeeResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _employeeClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Contoso", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string employeeApiVersion); + _employeeRestClient = new EmployeesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, employeeApiVersion); +#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 EmployeeData 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 Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeResource.Get"); + scope.Start(); + try + { + var response = await _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeResource.Get"); + scope.Start(); + try + { + var response = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmployeeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Delete + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.Delete"); + scope.Start(); + try + { + var response = await _employeeRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ContosoArmOperation(_employeeClientDiagnostics, Pipeline, _employeeRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Delete a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Delete + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.Delete"); + scope.Start(); + try + { + var response = _employeeRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new ContosoArmOperation(_employeeClientDiagnostics, Pipeline, _employeeRestClient.CreateDeleteRequest(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; + } + } + + /// + /// Update a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Update + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeResource.Update"); + scope.Start(); + try + { + var response = await _employeeRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EmployeeResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Update + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _employeeClientDiagnostics.CreateScope("EmployeeResource.Update"); + scope.Start(); + try + { + var response = _employeeRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + return Response.FromValue(new EmployeeResource(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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new EmployeeData(current.Location); + 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new EmployeeData(current.Location); + 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new EmployeeData(current.Location); + 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new EmployeeData(current.Location); + 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 _employeeRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new EmployeeData(current.Location); + 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.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-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 = _employeeClientDiagnostics.CreateScope("EmployeeResource.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 = _employeeRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new EmployeeResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new EmployeeData(current.Location); + 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/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/ContosoExtensions.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/ContosoExtensions.cs new file mode 100644 index 000000000000..3e8c2e0d8d70 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/ContosoExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Contoso.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Contoso +{ + /// A class to add extension methods to Azure.ResourceManager.Contoso. + public static partial class ContosoExtensions + { + private static MockableContosoArmClient GetMockableContosoArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableContosoArmClient(client0)); + } + + private static MockableContosoResourceGroupResource GetMockableContosoResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableContosoResourceGroupResource(client, resource.Id)); + } + + private static MockableContosoSubscriptionResource GetMockableContosoSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableContosoSubscriptionResource(client, resource.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 EmployeeResource GetEmployeeResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableContosoArmClient(client).GetEmployeeResource(id); + } + + /// + /// Gets a collection of EmployeeResources 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 EmployeeResources and their operations over a EmployeeResource. + public static EmployeeCollection GetEmployees(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableContosoResourceGroupResource(resourceGroupResource).GetEmployees(); + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Employee. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetEmployeeAsync(this ResourceGroupResource resourceGroupResource, string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableContosoResourceGroupResource(resourceGroupResource).GetEmployeeAsync(employeeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Employee. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetEmployee(this ResourceGroupResource resourceGroupResource, string employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableContosoResourceGroupResource(resourceGroupResource).GetEmployee(employeeName, cancellationToken); + } + + /// + /// List Employee resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListBySubscription + /// + /// + /// Default Api Version + /// 2021-11-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 GetEmployeesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContosoSubscriptionResource(subscriptionResource).GetEmployeesAsync(cancellationToken); + } + + /// + /// List Employee resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListBySubscription + /// + /// + /// Default Api Version + /// 2021-11-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 GetEmployees(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableContosoSubscriptionResource(subscriptionResource).GetEmployees(cancellationToken); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoArmClient.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoArmClient.cs new file mode 100644 index 000000000000..9dd8be4758d4 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.Contoso.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableContosoArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContosoArmClient() + { + } + + /// 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 MockableContosoArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableContosoArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual EmployeeResource GetEmployeeResource(ResourceIdentifier id) + { + EmployeeResource.ValidateResourceId(id); + return new EmployeeResource(Client, id); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoResourceGroupResource.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoResourceGroupResource.cs new file mode 100644 index 000000000000..a4c47d382ed8 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Contoso.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableContosoResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableContosoResourceGroupResource() + { + } + + /// 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 MockableContosoResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of EmployeeResources in the ResourceGroupResource. + /// An object representing collection of EmployeeResources and their operations over a EmployeeResource. + public virtual EmployeeCollection GetEmployees() + { + return GetCachedClient(client => new EmployeeCollection(client, Id)); + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetEmployeeAsync(string employeeName, CancellationToken cancellationToken = default) + { + return await GetEmployees().GetAsync(employeeName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Employee + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Contoso/employees/{employeeName} + /// + /// + /// Operation Id + /// Employee_Get + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the Employee. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetEmployee(string employeeName, CancellationToken cancellationToken = default) + { + return GetEmployees().Get(employeeName, cancellationToken); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoSubscriptionResource.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoSubscriptionResource.cs new file mode 100644 index 000000000000..6a116f9716a3 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Extensions/MockableContosoSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Contoso.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableContosoSubscriptionResource : ArmResource + { + private ClientDiagnostics _employeeClientDiagnostics; + private EmployeesRestOperations _employeeRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableContosoSubscriptionResource() + { + } + + /// 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 MockableContosoSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics EmployeeClientDiagnostics => _employeeClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Contoso", EmployeeResource.ResourceType.Namespace, Diagnostics); + private EmployeesRestOperations EmployeeRestClient => _employeeRestClient ??= new EmployeesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(EmployeeResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Employee resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListBySubscription + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetEmployeesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmployeeRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmployeeRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmployeeResource(Client, EmployeeData.DeserializeEmployeeData(e)), EmployeeClientDiagnostics, Pipeline, "MockableContosoSubscriptionResource.GetEmployees", "value", "nextLink", cancellationToken); + } + + /// + /// List Employee resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Contoso/employees + /// + /// + /// Operation Id + /// Employee_ListBySubscription + /// + /// + /// Default Api Version + /// 2021-11-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetEmployees(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => EmployeeRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => EmployeeRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmployeeResource(Client, EmployeeData.DeserializeEmployeeData(e)), EmployeeClientDiagnostics, Pipeline, "MockableContosoSubscriptionResource.GetEmployees", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Argument.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..b146fadb7828 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Contoso +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..c2b481265f05 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Contoso +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingList.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..28e10b878f86 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// 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.Linq; + +namespace Azure.ResourceManager.Contoso +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..5b13d8c23e13 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.Contoso +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Optional.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..3d6bd293a801 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.Contoso +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..50d04f500cd4 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Contoso +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperation.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperation.cs new file mode 100644 index 000000000000..2badd30f1f7b --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperation.cs @@ -0,0 +1,94 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Contoso +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ContosoArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of ContosoArmOperation for mocking. + protected ContosoArmOperation() + { + } + + internal ContosoArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ContosoArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "ContosoArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperationOfT.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperationOfT.cs new file mode 100644 index 000000000000..4b59643530b2 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/ContosoArmOperationOfT.cs @@ -0,0 +1,100 @@ +// 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.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Contoso +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ContosoArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of ContosoArmOperation for mocking. + protected ContosoArmOperation() + { + } + + internal ContosoArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ContosoArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "ContosoArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/EmployeeOperationSource.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/EmployeeOperationSource.cs new file mode 100644 index 000000000000..40897fe08bcb --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/LongRunningOperation/EmployeeOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Contoso +{ + internal class EmployeeOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal EmployeeOperationSource(ArmClient client) + { + _client = client; + } + + EmployeeResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new EmployeeResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new EmployeeResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.Serialization.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.Serialization.cs new file mode 100644 index 000000000000..5a1ac3f3643f --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Contoso.Models +{ + internal partial class EmployeeListResult : 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(EmployeeListResult)} 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EmployeeListResult 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(EmployeeListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEmployeeListResult(document.RootElement, options); + } + + internal static EmployeeListResult DeserializeEmployeeListResult(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(EmployeeData.DeserializeEmployeeData(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 EmployeeListResult(value, nextLink, 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(EmployeeListResult)} does not support writing '{options.Format}' format."); + } + } + + EmployeeListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeEmployeeListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EmployeeListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.cs new file mode 100644 index 000000000000..f40f6693d057 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Contoso.Models +{ + /// The response of a Employee list operation. + internal partial class EmployeeListResult + { + /// + /// 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 Employee items on this page. + /// is null. + internal EmployeeListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Employee items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal EmployeeListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EmployeeListResult() + { + } + + /// The Employee items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.Serialization.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.Serialization.cs new file mode 100644 index 000000000000..5c469fe54d30 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.Serialization.cs @@ -0,0 +1,174 @@ +// 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.Contoso.Models +{ + public partial class EmployeeProperties : 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(EmployeeProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Age)) + { + writer.WritePropertyName("age"u8); + writer.WriteNumberValue(Age.Value); + } + if (Optional.IsDefined(City)) + { + writer.WritePropertyName("city"u8); + writer.WriteStringValue(City); + } + if (Optional.IsDefined(Profile)) + { + writer.WritePropertyName("profile"u8); + writer.WriteBase64StringValue(Profile, "U"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + EmployeeProperties 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(EmployeeProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEmployeeProperties(document.RootElement, options); + } + + internal static EmployeeProperties DeserializeEmployeeProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? age = default; + string city = default; + byte[] profile = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("age"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + age = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("city"u8)) + { + city = property.Value.GetString(); + continue; + } + if (property.NameEquals("profile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + profile = property.Value.GetBytesFromBase64("U"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EmployeeProperties(age, city, profile, provisioningState, 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(EmployeeProperties)} does not support writing '{options.Format}' format."); + } + } + + EmployeeProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeEmployeeProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EmployeeProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.cs new file mode 100644 index 000000000000..f17e5ee5c7df --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/EmployeeProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Contoso.Models +{ + /// Employee properties. + public partial class EmployeeProperties + { + /// + /// 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 EmployeeProperties() + { + } + + /// Initializes a new instance of . + /// Age of employee. + /// City of employee. + /// Profile of employee. + /// The status of the last operation. + /// Keeps track of any properties unknown to the library. + internal EmployeeProperties(int? age, string city, byte[] profile, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + Age = age; + City = city; + Profile = profile; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Age of employee. + public int? Age { get; set; } + /// City of employee. + public string City { get; set; } + /// Profile of employee. + public byte[] Profile { get; set; } + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/ProvisioningState.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..3b650fd30ca1 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/Models/ProvisioningState.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.Contoso.Models +{ + /// The resource provisioning state. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(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 ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// The resource is being provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// The resource is updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// The resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// The resource create request has been accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState 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/contoso/Azure.ResourceManager.Contoso/src/Generated/ProviderConstants.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..58224a637312 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Contoso +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/RestOperations/EmployeesRestOperations.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/RestOperations/EmployeesRestOperations.cs new file mode 100644 index 000000000000..b13e791dc40f --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Generated/RestOperations/EmployeesRestOperations.cs @@ -0,0 +1,731 @@ +// 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.Contoso.Models; + +namespace Azure.ResourceManager.Contoso +{ + internal partial class EmployeesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EmployeesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public EmployeesRestOperations(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 ?? "2021-11-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string employeeName) + { + 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string employeeName) + { + 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Employee. + /// 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 Employee. + /// 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 employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, employeeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmployeeData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeData.DeserializeEmployeeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EmployeeData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Employee. + /// 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 Employee. + /// 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 employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, employeeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmployeeData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeData.DeserializeEmployeeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EmployeeData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string employeeName, EmployeeData 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string employeeName, EmployeeData 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.Contoso/employees/", false); + uri.AppendPath(employeeName, 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; + } + + /// Create a Employee. + /// 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 Employee. + /// Resource create parameters. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, employeeName, 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); + } + } + + /// Create a Employee. + /// 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 Employee. + /// Resource create parameters. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, employeeName, data); + _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 employeeName, EmployeeData 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string employeeName, EmployeeData data) + { + 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.Contoso/employees/", false); + uri.AppendPath(employeeName, 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; + } + + /// Update a Employee. + /// 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 Employee. + /// The resource properties to be updated. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, employeeName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmployeeData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeData.DeserializeEmployeeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Employee. + /// 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 Employee. + /// The resource properties to be updated. + /// 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 employeeName, EmployeeData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, employeeName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmployeeData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeData.DeserializeEmployeeData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string employeeName) + { + 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string employeeName) + { + 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.Contoso/employees/", false); + uri.AppendPath(employeeName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Employee. + /// 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 Employee. + /// 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 employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, employeeName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Employee. + /// 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 Employee. + /// 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 employeeName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(employeeName, nameof(employeeName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, employeeName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return 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.Contoso/employees", 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.Contoso/employees", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Employee resources by 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: + { + EmployeeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Employee resources by 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: + { + EmployeeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Contoso/employees", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(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.Contoso/employees", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Employee resources by subscription ID. + /// 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> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmployeeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Employee resources by subscription ID. + /// 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 ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmployeeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeListResult.DeserializeEmployeeListResult(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; + } + + /// List Employee resources by 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: + { + EmployeeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Employee resources by 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: + { + EmployeeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeListResult.DeserializeEmployeeListResult(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); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(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; + } + + /// List Employee resources by subscription ID. + /// 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> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmployeeListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Employee resources by subscription ID. + /// 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 ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmployeeListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = EmployeeListResult.DeserializeEmployeeListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/src/Properties/AssemblyInfo.cs b/sdk/contoso/Azure.ResourceManager.Contoso/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..113b6ed3d98f --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.Contoso.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Contoso")] diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/tests/Azure.ResourceManager.Contoso.Tests.csproj b/sdk/contoso/Azure.ResourceManager.Contoso/tests/Azure.ResourceManager.Contoso.Tests.csproj new file mode 100644 index 000000000000..4b906ef77fda --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/tests/Azure.ResourceManager.Contoso.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestBase.cs b/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestBase.cs new file mode 100644 index 000000000000..77599a7902fe --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Contoso.Tests +{ + public class ContosoManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected ContosoManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ContosoManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestEnvironment.cs b/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestEnvironment.cs new file mode 100644 index 000000000000..b1c4c91e35b3 --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/tests/ContosoManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Contoso.Tests +{ + public class ContosoManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/contoso/Azure.ResourceManager.Contoso/tsp-location.yaml b/sdk/contoso/Azure.ResourceManager.Contoso/tsp-location.yaml new file mode 100644 index 000000000000..6c310952d36e --- /dev/null +++ b/sdk/contoso/Azure.ResourceManager.Contoso/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/contosowidgetmanager/Contoso.Management +commit: a3dcf1c9eb0324a1e4e9a12ec4655f54ba1f44f5 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/contoso/ci.mgmt.yml b/sdk/contoso/ci.mgmt.yml new file mode 100644 index 000000000000..3485a663b46d --- /dev/null +++ b/sdk/contoso/ci.mgmt.yml @@ -0,0 +1,26 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/contoso /ci.mgmt.yml + - sdk/contoso /Azure.ResourceManager.Contoso / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: contoso + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.Contoso + safeName: AzureResourceManagerContoso diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln b/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln new file mode 100644 index 000000000000..b8a126d8fc2a --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/Azure.Template.Contoso.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Template.Contoso", "src\Azure.Template.Contoso.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Template.Contoso.Tests", "tests\Azure.Template.Contoso.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md b/sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props b/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md b/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md new file mode 100644 index 000000000000..e316c602298d --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/README.md @@ -0,0 +1,107 @@ +# Azure.Template.Contoso client library for .NET + +Azure.Template.Contoso is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/contosowidgetmanager/Azure.Template.Contoso/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.Template.Contoso --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +### Service API versions + +The client library targets the latest service API version by default. A client instance accepts an optional service API version parameter from its options to specify which API version service to communicate. + +#### Select a service API version + +You have the flexibility to explicitly select a supported service API version when instantiating a client by configuring its associated options. This ensures that the client can communicate with services using the specified API version. + +For example, + +```C# Snippet:CreateClientForSpecificApiVersion +Uri endpoint = new Uri(""); +DefaultAzureCredential credential = new DefaultAzureCredential(); +ClientOptions options = new ClientOptions(ClientOptions.ServiceVersion.) +var client = new Client(endpoint, credential, options); +``` + +When selecting an API version, it's important to verify that there are no breaking changes compared to the latest API version. If there are significant differences, API calls may fail due to incompatibility. + +Always ensure that the chosen API version is fully supported and operational for your specific use case and that it aligns with the service's versioning policy. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/contosowidgetmanager/Azure.Template.Contoso/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/contosowidgetmanager/Azure.Template.Contoso/README.png) \ No newline at end of file diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs new file mode 100644 index 000000000000..5f4aeb69c4f0 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.net8.0.cs @@ -0,0 +1,115 @@ +namespace Azure.Template.Contoso +{ + public partial class ContosoWidgets + { + protected ContosoWidgets() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation CreateOrUpdateWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWidget(string widgetName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetWidget(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetWidgetAsync(string widgetName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetWidgetAsync(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetWidgetOperationStatusAsync(string widgetName, string operationId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWidgets(Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetWidgets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWidgetsAsync(Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetWidgetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class FakedSharedModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FakedSharedModel(string tag, System.DateTimeOffset createdAt) { } + public System.DateTimeOffset CreatedAt { get { throw null; } set { } } + public string Tag { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.Template.Contoso.OperationState Canceled { get { throw null; } } + public static Azure.Template.Contoso.OperationState Failed { get { throw null; } } + public static Azure.Template.Contoso.OperationState NotStarted { get { throw null; } } + public static Azure.Template.Contoso.OperationState Running { get { throw null; } } + public static Azure.Template.Contoso.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.Template.Contoso.OperationState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; } + public static implicit operator Azure.Template.Contoso.OperationState (string value) { throw null; } + public static bool operator !=(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() { } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Template.Contoso.WidgetSuite Result { get { throw null; } } + public Azure.Template.Contoso.OperationState Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class TemplateContosoModelFactory + { + public static Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, Azure.Template.Contoso.OperationState status = default(Azure.Template.Contoso.OperationState), Azure.ResponseError error = null, Azure.Template.Contoso.WidgetSuite result = null) { throw null; } + public static Azure.Template.Contoso.WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, Azure.Template.Contoso.FakedSharedModel sharedModel = null) { throw null; } + } + public partial class WidgetManagerClient + { + protected WidgetManagerClient() { } + public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Template.Contoso.WidgetManagerClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Template.Contoso.ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") { throw null; } + } + public partial class WidgetManagerClientOptions : Azure.Core.ClientOptions + { + public WidgetManagerClientOptions(Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion version = Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion.V2022_12_01) { } + public enum ServiceVersion + { + V2022_12_01 = 1, + } + } + public partial class WidgetSuite : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WidgetSuite(string manufacturerId) { } + public string ManufacturerId { get { throw null; } set { } } + public string Name { get { throw null; } } + public Azure.Template.Contoso.FakedSharedModel SharedModel { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class TemplateContosoClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs new file mode 100644 index 000000000000..5f4aeb69c4f0 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/api/Azure.Template.Contoso.netstandard2.0.cs @@ -0,0 +1,115 @@ +namespace Azure.Template.Contoso +{ + public partial class ContosoWidgets + { + protected ContosoWidgets() { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Operation CreateOrUpdateWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; } + public virtual Azure.Operation DeleteWidget(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteWidgetAsync(Azure.WaitUntil waitUntil, string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWidget(string widgetName, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetWidget(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetWidgetAsync(string widgetName, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetWidgetAsync(string widgetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetWidgetOperationStatus(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetWidgetOperationStatusAsync(string widgetName, string operationId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWidgets(Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetWidgets(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWidgetsAsync(Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetWidgetsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class FakedSharedModel : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public FakedSharedModel(string tag, System.DateTimeOffset createdAt) { } + public System.DateTimeOffset CreatedAt { get { throw null; } set { } } + public string Tag { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.FakedSharedModel System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OperationState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OperationState(string value) { throw null; } + public static Azure.Template.Contoso.OperationState Canceled { get { throw null; } } + public static Azure.Template.Contoso.OperationState Failed { get { throw null; } } + public static Azure.Template.Contoso.OperationState NotStarted { get { throw null; } } + public static Azure.Template.Contoso.OperationState Running { get { throw null; } } + public static Azure.Template.Contoso.OperationState Succeeded { get { throw null; } } + public bool Equals(Azure.Template.Contoso.OperationState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; } + public static implicit operator Azure.Template.Contoso.OperationState (string value) { throw null; } + public static bool operator !=(Azure.Template.Contoso.OperationState left, Azure.Template.Contoso.OperationState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() { } + public Azure.ResponseError Error { get { throw null; } } + public string Id { get { throw null; } } + public Azure.Template.Contoso.WidgetSuite Result { get { throw null; } } + public Azure.Template.Contoso.OperationState Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class TemplateContosoModelFactory + { + public static Azure.Template.Contoso.ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, Azure.Template.Contoso.OperationState status = default(Azure.Template.Contoso.OperationState), Azure.ResponseError error = null, Azure.Template.Contoso.WidgetSuite result = null) { throw null; } + public static Azure.Template.Contoso.WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, Azure.Template.Contoso.FakedSharedModel sharedModel = null) { throw null; } + } + public partial class WidgetManagerClient + { + protected WidgetManagerClient() { } + public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential) { } + public WidgetManagerClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Template.Contoso.WidgetManagerClientOptions options) { } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Template.Contoso.ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") { throw null; } + } + public partial class WidgetManagerClientOptions : Azure.Core.ClientOptions + { + public WidgetManagerClientOptions(Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion version = Azure.Template.Contoso.WidgetManagerClientOptions.ServiceVersion.V2022_12_01) { } + public enum ServiceVersion + { + V2022_12_01 = 1, + } + } + public partial class WidgetSuite : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WidgetSuite(string manufacturerId) { } + public string ManufacturerId { get { throw null; } set { } } + public string Name { get { throw null; } } + public Azure.Template.Contoso.FakedSharedModel SharedModel { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.Template.Contoso.WidgetSuite System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} +namespace Microsoft.Extensions.Azure +{ + public static partial class TemplateContosoClientBuilderExtensions + { + public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithCredential { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj new file mode 100644 index 000000000000..8e26ba2f2db8 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Azure.Template.Contoso.csproj @@ -0,0 +1,19 @@ + + + This is the Azure.Template.Contoso client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.Template.Contoso for Azure Data Plane + 1.0.0-beta.1 + Azure.Template.Contoso + $(RequiredTargetFrameworks) + true + + + + + + + + + + + diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs new file mode 100644 index 000000000000..805332d7b840 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ContosoWidgets.cs @@ -0,0 +1,661 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Template.Contoso +{ + // Data plane generated sub-client. + /// The ContosoWidgets sub-client. + public partial class ContosoWidgets + { + private static readonly string[] AuthorizationScopes = new string[] { "https://contoso.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ContosoWidgets for mocking. + protected ContosoWidgets() + { + } + + /// Initializes a new instance of ContosoWidgets. + /// The handler for diagnostic messaging in the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The token credential to copy. + /// Service host. + /// The API version to use for this operation. + internal ContosoWidgets(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, TokenCredential tokenCredential, Uri endpoint, string apiVersion) + { + ClientDiagnostics = clientDiagnostics; + _pipeline = pipeline; + _tokenCredential = tokenCredential; + _endpoint = endpoint; + _apiVersion = apiVersion; + } + + /// Fetch a Widget by name. + /// The widget name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetWidgetAsync(string widgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetWidgetAsync(widgetName, context).ConfigureAwait(false); + return Response.FromValue(WidgetSuite.FromResponse(response), response); + } + + /// Fetch a Widget by name. + /// The widget name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetWidget(string widgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetWidget(widgetName, context); + return Response.FromValue(WidgetSuite.FromResponse(response), response); + } + + /// + /// [Protocol Method] Fetch a Widget by name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The widget name. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWidgetAsync(string widgetName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWidgetRequest(widgetName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Fetch a Widget by name. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The widget name. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWidget(string widgetName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWidgetRequest(widgetName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets status of a Widget operation. + /// The widget name. + /// The unique ID of the operation. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetWidgetOperationStatusAsync(string widgetName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetWidgetOperationStatusAsync(widgetName, operationId, context).ConfigureAwait(false); + return Response.FromValue(ResourceOperationStatusWidgetSuiteWidgetSuiteError.FromResponse(response), response); + } + + /// Gets status of a Widget operation. + /// The widget name. + /// The unique ID of the operation. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response GetWidgetOperationStatus(string widgetName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetWidgetOperationStatus(widgetName, operationId, context); + return Response.FromValue(ResourceOperationStatusWidgetSuiteWidgetSuiteError.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets status of a Widget operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The widget name. + /// The unique ID of the operation. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetWidgetOperationStatusAsync(string widgetName, string operationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidgetOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWidgetOperationStatusRequest(widgetName, operationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets status of a Widget operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The widget name. + /// The unique ID of the operation. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetWidgetOperationStatus(string widgetName, string operationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.GetWidgetOperationStatus"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWidgetOperationStatusRequest(widgetName, operationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// List Widget resources. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetWidgetsAsync(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => WidgetSuite.DeserializeWidgetSuite(e), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context); + } + + /// List Widget resources. + /// The cancellation token to use. + /// + public virtual Pageable GetWidgets(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => WidgetSuite.DeserializeWidgetSuite(e), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List Widget resources + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetWidgetsAsync(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context); + } + + /// + /// [Protocol Method] List Widget resources + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetWidgets(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWidgetsRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWidgetsNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ContosoWidgets.GetWidgets", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Creates or updates a Widget asynchronously. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 widget name. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> CreateOrUpdateWidgetAsync(WaitUntil waitUntil, string widgetName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.CreateOrUpdateWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateWidgetRequest(widgetName, content, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ContosoWidgets.CreateOrUpdateWidget", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a Widget asynchronously. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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 widget name. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation CreateOrUpdateWidget(WaitUntil waitUntil, string widgetName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.CreateOrUpdateWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateWidgetRequest(widgetName, content, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ContosoWidgets.CreateOrUpdateWidget", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Delete a Widget asynchronously. + /// 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 widget name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> DeleteWidgetAsync(WaitUntil waitUntil, string widgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Operation response = await DeleteWidgetAsync(waitUntil, widgetName, context).ConfigureAwait(false); + return ProtocolOperationHelpers.Convert(response, FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError, ClientDiagnostics, "ContosoWidgets.DeleteWidget"); + } + + /// Delete a Widget asynchronously. + /// 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 widget name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Operation DeleteWidget(WaitUntil waitUntil, string widgetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Operation response = DeleteWidget(waitUntil, widgetName, context); + return ProtocolOperationHelpers.Convert(response, FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError, ClientDiagnostics, "ContosoWidgets.DeleteWidget"); + } + + /// + /// [Protocol Method] Delete a Widget asynchronously. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// 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 widget name. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual async Task> DeleteWidgetAsync(WaitUntil waitUntil, string widgetName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.DeleteWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWidgetRequest(widgetName, context); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ContosoWidgets.DeleteWidget", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Delete a Widget asynchronously. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// 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 widget name. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The representing an asynchronous operation on the service. + /// + public virtual Operation DeleteWidget(WaitUntil waitUntil, string widgetName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(widgetName, nameof(widgetName)); + + using var scope = ClientDiagnostics.CreateScope("ContosoWidgets.DeleteWidget"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWidgetRequest(widgetName, context); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ContosoWidgets.DeleteWidget", OperationFinalStateVia.OperationLocation, context, waitUntil); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetWidgetRequest(string widgetName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/widgets/", false); + uri.AppendPath(widgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWidgetOperationStatusRequest(string widgetName, string operationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/widgets/", false); + uri.AppendPath(widgetName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrUpdateWidgetRequest(string widgetName, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200201); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/widgets/", false); + uri.AppendPath(widgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteWidgetRequest(string widgetName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier202); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/widgets/", false); + uri.AppendPath(widgetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWidgetsRequest(RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/widgets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWidgetsNextPageRequest(string nextLink, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + 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"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier200201; + private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); + private static ResponseClassifier _responseClassifier202; + private static ResponseClassifier ResponseClassifier202 => _responseClassifier202 ??= new StatusCodeClassifier(stackalloc ushort[] { 202 }); + + private WidgetSuite FetchWidgetSuiteFromResourceOperationStatusWidgetSuiteWidgetSuiteError(Response response) + { + var resultJsonElement = JsonDocument.Parse(response.Content).RootElement.GetProperty("result"); + return WidgetSuite.DeserializeWidgetSuite(resultJsonElement); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml new file mode 100644 index 000000000000..f93a7fff74d1 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Docs/ContosoWidgets.xml @@ -0,0 +1,273 @@ + + + + + +This sample shows how to call GetWidgetAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = await client.GetWidgetAsync("searchbox"); +]]> + + + +This sample shows how to call GetWidget. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = client.GetWidget("searchbox"); +]]> + + + +This sample shows how to call GetWidgetAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = await client.GetWidgetAsync("searchbox", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + +This sample shows how to call GetWidget and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = client.GetWidget("searchbox", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + +This sample shows how to call GetWidgetOperationStatusAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1"); +]]> + + + +This sample shows how to call GetWidgetOperationStatus. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = client.GetWidgetOperationStatus("name1", "opreation id1"); +]]> + + + +This sample shows how to call GetWidgetOperationStatusAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call GetWidgetOperationStatus and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Response response = client.GetWidgetOperationStatus("name1", "opreation id1", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +]]> + + + +This sample shows how to call GetWidgetsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +await foreach (WidgetSuite item in client.GetWidgetsAsync()) +{ +} +]]> + + + +This sample shows how to call GetWidgets. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +foreach (WidgetSuite item in client.GetWidgets()) +{ +} +]]> + + + +This sample shows how to call GetWidgetsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +await foreach (BinaryData item in client.GetWidgetsAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +} +]]> + + + +This sample shows how to call GetWidgets and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +foreach (BinaryData item in client.GetWidgets(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +} +]]> + + + +This sample shows how to call CreateOrUpdateWidgetAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +using RequestContent content = RequestContent.Create(new +{ + manufacturerId = "manufacturer id1", + sharedModel = new + { + tag = "tag1", + createdAt = "2023-01-09T02:12:25.689Z", + }, +}); +Operation operation = await client.CreateOrUpdateWidgetAsync(WaitUntil.Completed, "name1", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + +This sample shows how to call CreateOrUpdateWidget and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +using RequestContent content = RequestContent.Create(new +{ + manufacturerId = "manufacturer id1", + sharedModel = new + { + tag = "tag1", + createdAt = "2023-01-09T02:12:25.689Z", + }, +}); +Operation operation = client.CreateOrUpdateWidget(WaitUntil.Completed, "name1", content); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + +This sample shows how to call DeleteWidgetAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox"); +WidgetSuite responseData = operation.Value; +]]> + + + +This sample shows how to call DeleteWidget. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox"); +WidgetSuite responseData = operation.Value; +]]> + + + +This sample shows how to call DeleteWidgetAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + +This sample shows how to call DeleteWidget and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + +Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox", null); +BinaryData responseData = operation.Value; + +JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("manufacturerId").ToString()); +]]> + + + \ No newline at end of file diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs rename to sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs index 3a81222297b3..e852c0eb26bc 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.Serialization.cs +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.Serialization.cs @@ -11,13 +11,13 @@ using System.Text.Json; using Azure.Core; -namespace Azure.AI.Vision.Face +namespace Azure.Template.Contoso { - public partial class AuditRequestInfo : IUtf8JsonSerializable, IJsonModel + public partial class FakedSharedModel : 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,28 +28,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriter /// 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(AuditRequestInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(FakedSharedModel)} does not support writing '{format}' format."); } - writer.WritePropertyName("url"u8); - writer.WriteStringValue(Url); - writer.WritePropertyName("method"u8); - writer.WriteStringValue(Method); - if (Optional.IsDefined(ContentLength)) - { - writer.WritePropertyName("contentLength"u8); - writer.WriteNumberValue(ContentLength.Value); - } - writer.WritePropertyName("contentType"u8); - writer.WriteStringValue(ContentType); - if (Optional.IsDefined(UserAgent)) - { - writer.WritePropertyName("userAgent"u8); - writer.WriteStringValue(UserAgent); - } + writer.WritePropertyName("tag"u8); + writer.WriteStringValue(Tag); + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt, "O"); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -67,19 +55,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditRequestInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + FakedSharedModel 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(AuditRequestInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(FakedSharedModel)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeFakedSharedModel(document.RootElement, options); } - internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static FakedSharedModel DeserializeFakedSharedModel(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,42 +75,20 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element { return null; } - string url = default; - string method = default; - long? contentLength = default; - string contentType = default; - string userAgent = default; + string tag = default; + DateTimeOffset createdAt = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("url"u8)) - { - url = property.Value.GetString(); - continue; - } - if (property.NameEquals("method"u8)) - { - method = property.Value.GetString(); - continue; - } - if (property.NameEquals("contentLength"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - contentLength = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("contentType"u8)) + if (property.NameEquals("tag"u8)) { - contentType = property.Value.GetString(); + tag = property.Value.GetString(); continue; } - if (property.NameEquals("userAgent"u8)) + if (property.NameEquals("createdAt"u8)) { - userAgent = property.Value.GetString(); + createdAt = property.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") @@ -131,52 +97,46 @@ internal static AuditRequestInfo DeserializeAuditRequestInfo(JsonElement element } } serializedAdditionalRawData = rawDataDictionary; - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData); + return new FakedSharedModel(tag, createdAt, 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(AuditRequestInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(FakedSharedModel)} does not support writing '{options.Format}' format."); } } - AuditRequestInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + FakedSharedModel IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditRequestInfo(document.RootElement, options); + return DeserializeFakedSharedModel(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditRequestInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(FakedSharedModel)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static AuditRequestInfo FromResponse(Response response) + internal static FakedSharedModel FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditRequestInfo(document.RootElement); + return DeserializeFakedSharedModel(document.RootElement); } /// Convert into a . diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs new file mode 100644 index 000000000000..0ebce4cf58ed --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/FakedSharedModel.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + /// Faked shared model. + public partial class FakedSharedModel + { + /// + /// 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 tag. + /// The created date. + /// is null. + public FakedSharedModel(string tag, DateTimeOffset createdAt) + { + Argument.AssertNotNull(tag, nameof(tag)); + + Tag = tag; + CreatedAt = createdAt; + } + + /// Initializes a new instance of . + /// The tag. + /// The created date. + /// Keeps track of any properties unknown to the library. + internal FakedSharedModel(string tag, DateTimeOffset createdAt, IDictionary serializedAdditionalRawData) + { + Tag = tag; + CreatedAt = createdAt; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FakedSharedModel() + { + } + + /// The tag. + public string Tag { get; set; } + /// The created date. + public DateTimeOffset CreatedAt { get; set; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..6d81344fe1d7 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..fba592e87808 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..5d1cec4e0093 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// 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.Linq; + +namespace Azure.Template.Contoso +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..bfa9471431fb --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.Template.Contoso +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..072e7659b006 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.Template.Contoso +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..6dbde35752a2 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.Template.Contoso +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs new file mode 100644 index 000000000000..de05771393ce --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/OperationState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Template.Contoso +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationState(string value) => new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + /// + public bool Equals(OperationState 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/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs new file mode 100644 index 000000000000..3df98b2b0909 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.Serialization.cs @@ -0,0 +1,180 @@ +// 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.Template.Contoso +{ + public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError : 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceOperationStatusWidgetSuiteWidgetSuiteError 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(document.RootElement, options); + } + + internal static ResourceOperationStatusWidgetSuiteWidgetSuiteError DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + OperationState status = default; + ResponseError error = default; + WidgetSuite result = 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("status"u8)) + { + status = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = WidgetSuite.DeserializeWidgetSuite(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceOperationStatusWidgetSuiteWidgetSuiteError(id, status, error, result, 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(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support writing '{options.Format}' format."); + } + } + + ResourceOperationStatusWidgetSuiteWidgetSuiteError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceOperationStatusWidgetSuiteWidgetSuiteError)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ResourceOperationStatusWidgetSuiteWidgetSuiteError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceOperationStatusWidgetSuiteWidgetSuiteError(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs new file mode 100644 index 000000000000..d2a07ed0b367 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/ResourceOperationStatusWidgetSuiteWidgetSuiteError.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + /// Provides status details for long running operations. + public partial class ResourceOperationStatusWidgetSuiteWidgetSuiteError + { + /// + /// 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 unique ID of the operation. + /// The status of the operation. + /// is null. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id, OperationState status) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + Status = status; + } + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// Keeps track of any properties unknown to the library. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id, OperationState status, ResponseError error, WidgetSuite result, IDictionary serializedAdditionalRawData) + { + Id = id; + Status = status; + Error = error; + Result = result; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceOperationStatusWidgetSuiteWidgetSuiteError() + { + } + + /// The unique ID of the operation. + public string Id { get; } + /// The status of the operation. + public OperationState Status { get; } + /// Error object that describes the error when status is "Failed". + public ResponseError Error { get; } + /// The result of the operation. + public WidgetSuite Result { get; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs new file mode 100644 index 000000000000..34e50338c431 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoClientBuilderExtensions.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core.Extensions; +using Azure.Template.Contoso; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class TemplateContosoClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// Service host. + public static IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new WidgetManagerClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddWidgetManagerClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs new file mode 100644 index 000000000000..1a64eda68bce --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/TemplateContosoModelFactory.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Template.Contoso +{ + /// Model factory for models. + public static partial class TemplateContosoModelFactory + { + /// Initializes a new instance of . + /// The widget name. + /// The ID of the widget's manufacturer. + /// The faked shared model. + /// A new instance for mocking. + public static WidgetSuite WidgetSuite(string name = null, string manufacturerId = null, FakedSharedModel sharedModel = null) + { + return new WidgetSuite(name, manufacturerId, sharedModel, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The unique ID of the operation. + /// The status of the operation. + /// Error object that describes the error when status is "Failed". + /// The result of the operation. + /// A new instance for mocking. + public static ResourceOperationStatusWidgetSuiteWidgetSuiteError ResourceOperationStatusWidgetSuiteWidgetSuiteError(string id = null, OperationState status = default, ResponseError error = null, WidgetSuite result = null) + { + return new ResourceOperationStatusWidgetSuiteWidgetSuiteError(id, status, error, result, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs new file mode 100644 index 000000000000..a4d30b4e1fb2 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClient.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Template.Contoso +{ + // Data plane generated client. + /// The WidgetManager service client. + public partial class WidgetManagerClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://contoso.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of WidgetManagerClient for mocking. + protected WidgetManagerClient() + { + } + + /// Initializes a new instance of WidgetManagerClient. + /// Service host. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public WidgetManagerClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new WidgetManagerClientOptions()) + { + } + + /// Initializes a new instance of WidgetManagerClient. + /// Service host. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public WidgetManagerClient(Uri endpoint, TokenCredential credential, WidgetManagerClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new WidgetManagerClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + } + + /// Initializes a new instance of ContosoWidgets. + /// The API version to use for this operation. + /// is null. + public virtual ContosoWidgets GetContosoWidgetsClient(string apiVersion = "2022-12-01") + { + Argument.AssertNotNull(apiVersion, nameof(apiVersion)); + + return new ContosoWidgets(ClientDiagnostics, _pipeline, _tokenCredential, _endpoint, apiVersion); + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs new file mode 100644 index 000000000000..c451e0c67e97 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetManagerClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Template.Contoso +{ + /// Client options for WidgetManagerClient. + public partial class WidgetManagerClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2022_12_01; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2022-12-01". + V2022_12_01 = 1, + } + + internal string Version { get; } + + /// Initializes new instance of WidgetManagerClientOptions. + public WidgetManagerClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2022_12_01 => "2022-12-01", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs rename to sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs index 4fb71cbac633..a1a04807038a 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.Serialization.cs +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.Serialization.cs @@ -11,13 +11,13 @@ using System.Text.Json; using Azure.Core; -namespace Azure.AI.Vision.Face +namespace Azure.Template.Contoso { - public partial class CreateLivenessWithVerifySessionResult : IUtf8JsonSerializable, IJsonModel + public partial class WidgetSuite : 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,20 +28,23 @@ 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(CreateLivenessWithVerifySessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(WidgetSuite)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); - if (Optional.IsDefined(VerifyImage)) + if (options.Format != "W") { - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WritePropertyName("manufacturerId"u8); + writer.WriteStringValue(ManufacturerId); + if (Optional.IsDefined(SharedModel)) + { + writer.WritePropertyName("sharedModel"u8); + writer.WriteObjectValue(SharedModel, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -60,19 +63,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessWithVerifySessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + WidgetSuite 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(CreateLivenessWithVerifySessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(WidgetSuite)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeWidgetSuite(document.RootElement, options); } - internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessWithVerifySessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static WidgetSuite DeserializeWidgetSuite(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -80,30 +83,30 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW { return null; } - string sessionId = default; - string authToken = default; - LivenessWithVerifyImage verifyImage = default; + string name = default; + string manufacturerId = default; + FakedSharedModel sharedModel = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("name"u8)) { - sessionId = property.Value.GetString(); + name = property.Value.GetString(); continue; } - if (property.NameEquals("authToken"u8)) + if (property.NameEquals("manufacturerId"u8)) { - authToken = property.Value.GetString(); + manufacturerId = property.Value.GetString(); continue; } - if (property.NameEquals("verifyImage"u8)) + if (property.NameEquals("sharedModel"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); + sharedModel = FakedSharedModel.DeserializeFakedSharedModel(property.Value, options); continue; } if (options.Format != "W") @@ -112,46 +115,46 @@ internal static CreateLivenessWithVerifySessionResult DeserializeCreateLivenessW } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData); + return new WidgetSuite(name, manufacturerId, sharedModel, 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(CreateLivenessWithVerifySessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(WidgetSuite)} does not support writing '{options.Format}' format."); } } - CreateLivenessWithVerifySessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + WidgetSuite IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement, options); + return DeserializeWidgetSuite(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(WidgetSuite)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static CreateLivenessWithVerifySessionResult FromResponse(Response response) + internal static WidgetSuite FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionResult(document.RootElement); + return DeserializeWidgetSuite(document.RootElement); } /// Convert into a . diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs new file mode 100644 index 000000000000..9ba44c829aa3 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Generated/WidgetSuite.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Template.Contoso +{ + /// A widget. + public partial class WidgetSuite + { + /// + /// 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 ID of the widget's manufacturer. + /// is null. + public WidgetSuite(string manufacturerId) + { + Argument.AssertNotNull(manufacturerId, nameof(manufacturerId)); + + ManufacturerId = manufacturerId; + } + + /// Initializes a new instance of . + /// The widget name. + /// The ID of the widget's manufacturer. + /// The faked shared model. + /// Keeps track of any properties unknown to the library. + internal WidgetSuite(string name, string manufacturerId, FakedSharedModel sharedModel, IDictionary serializedAdditionalRawData) + { + Name = name; + ManufacturerId = manufacturerId; + SharedModel = sharedModel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WidgetSuite() + { + } + + /// The widget name. + public string Name { get; } + /// The ID of the widget's manufacturer. + public string ManufacturerId { get; set; } + /// The faked shared model. + public FakedSharedModel SharedModel { get; set; } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..aa9fd891b234 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.Template.Contoso.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj new file mode 100644 index 000000000000..9b79d892421f --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Azure.Template.Contoso.Tests.csproj @@ -0,0 +1,20 @@ + + + $(RequiredTargetFrameworks) + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs new file mode 100644 index 000000000000..7b7e63a134ef --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tests/Generated/Samples/Samples_ContosoWidgets.cs @@ -0,0 +1,287 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Template.Contoso.Samples +{ + public partial class Samples_ContosoWidgets + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidget_GetWidgetByWidgetName() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidget("searchbox", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetAsync("searchbox", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidget("searchbox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidget_GetWidgetByWidgetName_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetAsync("searchbox"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidgetOperationStatus("name1", "opreation id1", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = client.GetWidgetOperationStatus("name1", "opreation id1"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ResourceOperationStatus_GetWidgetOperationStatus_WidgetsGetWidgetOperationStatus_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Response response = await client.GetWidgetOperationStatusAsync("name1", "opreation id1"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidgets_WidgetsListWidgets() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + foreach (BinaryData item in client.GetWidgets(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + await foreach (BinaryData item in client.GetWidgetsAsync(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + foreach (WidgetSuite item in client.GetWidgets()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_GetWidgets_WidgetsListWidgets_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + await foreach (WidgetSuite item in client.GetWidgetsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_CreateOrUpdateWidget_WidgetsCreateOrUpdateWidget() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + using RequestContent content = RequestContent.Create(new + { + manufacturerId = "manufacturer id1", + sharedModel = new + { + tag = "tag1", + createdAt = "2023-01-09T02:12:25.689Z", + }, + }); + Operation operation = client.CreateOrUpdateWidget(WaitUntil.Completed, "name1", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_CreateOrUpdateWidget_WidgetsCreateOrUpdateWidget_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + using RequestContent content = RequestContent.Create(new + { + manufacturerId = "manufacturer id1", + sharedModel = new + { + tag = "tag1", + createdAt = "2023-01-09T02:12:25.689Z", + }, + }); + Operation operation = await client.CreateOrUpdateWidgetAsync(WaitUntil.Completed, "name1", content); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox", null); + BinaryData responseData = operation.Value; + + JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("manufacturerId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Operation operation = client.DeleteWidget(WaitUntil.Completed, "searchbox"); + WidgetSuite responseData = operation.Value; + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_WidgetSuite_DeleteWidget_DeleteWidgetByWidgetNameUsingLongRunningOperation_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + ContosoWidgets client = new WidgetManagerClient(endpoint, credential).GetContosoWidgetsClient(apiVersion: "2022-12-01"); + + Operation operation = await client.DeleteWidgetAsync(WaitUntil.Completed, "searchbox"); + WidgetSuite responseData = operation.Value; + } + } +} diff --git a/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml b/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml new file mode 100644 index 000000000000..cc4e0364adc4 --- /dev/null +++ b/sdk/contosowidgetmanager/Azure.Template.Contoso/tsp-location.yaml @@ -0,0 +1,5 @@ +directory: specification/contosowidgetmanager/Contoso.WidgetManager +commit: a3dcf1c9eb0324a1e4e9a12ec4655f54ba1f44f5 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: +- specification/contosowidgetmanager/Contoso.WidgetManager.Shared diff --git a/sdk/contosowidgetmanager/ci.yml b/sdk/contosowidgetmanager/ci.yml new file mode 100644 index 000000000000..7f76decbce9e --- /dev/null +++ b/sdk/contosowidgetmanager/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/contosowidgetmanager + - sdk/contosowidgetmanager/ci.yml + - sdk/contosowidgetmanager/Azure.Template.Contoso + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/contosowidgetmanager + - sdk/contosowidgetmanager/ci.yml + - sdk/contosowidgetmanager/Azure.Template.Contoso + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: contosowidgetmanager + ArtifactName: packages + Artifacts: + - name: Azure.Template.Contoso + safeName: AzureTemplateContoso diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.net8.0.cs b/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.net8.0.cs index dcb36b235493..6e8aca3f5bcd 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.net8.0.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.net8.0.cs @@ -72,6 +72,8 @@ public static partial class FabricExtensions public static Azure.ResourceManager.Fabric.FabricCapacityResource GetFabricCapacityResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetSkusFabricCapacities(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetSkusFabricCapacitiesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetUsagesFabricCapacities(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetUsagesFabricCapacitiesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Fabric.Mocking @@ -97,6 +99,8 @@ protected MockableFabricSubscriptionResource() { } public virtual Azure.AsyncPageable GetFabricCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetSkusFabricCapacities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetSkusFabricCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesFabricCapacities(string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesFabricCapacitiesAsync(string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Fabric.Models @@ -106,8 +110,10 @@ public static partial class ArmFabricModelFactory public static Azure.ResourceManager.Fabric.FabricCapacityData FabricCapacityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Fabric.Models.FabricCapacityProperties properties = null, Azure.ResourceManager.Fabric.Models.FabricSku sku = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricCapacityProperties FabricCapacityProperties(Azure.ResourceManager.Fabric.Models.FabricProvisioningState? provisioningState = default(Azure.ResourceManager.Fabric.Models.FabricProvisioningState?), Azure.ResourceManager.Fabric.Models.FabricResourceState? state = default(Azure.ResourceManager.Fabric.Models.FabricResourceState?), System.Collections.Generic.IEnumerable administrationMembers = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricNameAvailabilityResult FabricNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.Fabric.Models.FabricNameUnavailableReason? reason = default(Azure.ResourceManager.Fabric.Models.FabricNameUnavailableReason?), string message = null) { throw null; } + public static Azure.ResourceManager.Fabric.Models.FabricQuota FabricQuota(Azure.ResourceManager.Fabric.Models.QuotaName name = null, string unit = null, long currentValue = (long)0, long limit = (long)0) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricSkuDetailsForExistingCapacity FabricSkuDetailsForExistingCapacity(string resourceType = null, Azure.ResourceManager.Fabric.Models.FabricSku sku = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricSkuDetailsForNewCapacity FabricSkuDetailsForNewCapacity(string resourceType = null, string name = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } + public static Azure.ResourceManager.Fabric.Models.QuotaName QuotaName(string value = null, string localizedValue = null) { throw null; } } public partial class FabricCapacityAdministration : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -211,6 +217,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Fabric.Models.FabricProvisioningState left, Azure.ResourceManager.Fabric.Models.FabricProvisioningState right) { throw null; } public override string ToString() { throw null; } } + public partial class FabricQuota : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FabricQuota() { } + public long CurrentValue { get { throw null; } } + public long Limit { get { throw null; } } + public Azure.ResourceManager.Fabric.Models.QuotaName Name { get { throw null; } } + public string Unit { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.FabricQuota System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.FabricQuota System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct FabricResourceState : System.IEquatable { @@ -293,4 +313,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Fabric.Models.FabricSkuTier left, Azure.ResourceManager.Fabric.Models.FabricSkuTier right) { throw null; } public override string ToString() { throw null; } } + public partial class QuotaName : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QuotaName() { } + public string LocalizedValue { get { throw null; } } + public string Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.QuotaName System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.QuotaName System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.netstandard2.0.cs b/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.netstandard2.0.cs index dcb36b235493..6e8aca3f5bcd 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.netstandard2.0.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/api/Azure.ResourceManager.Fabric.netstandard2.0.cs @@ -72,6 +72,8 @@ public static partial class FabricExtensions public static Azure.ResourceManager.Fabric.FabricCapacityResource GetFabricCapacityResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.Pageable GetSkusFabricCapacities(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetSkusFabricCapacitiesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Pageable GetUsagesFabricCapacities(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetUsagesFabricCapacitiesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Fabric.Mocking @@ -97,6 +99,8 @@ protected MockableFabricSubscriptionResource() { } public virtual Azure.AsyncPageable GetFabricCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetSkusFabricCapacities(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetSkusFabricCapacitiesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetUsagesFabricCapacities(string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetUsagesFabricCapacitiesAsync(string location, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.Fabric.Models @@ -106,8 +110,10 @@ public static partial class ArmFabricModelFactory public static Azure.ResourceManager.Fabric.FabricCapacityData FabricCapacityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Fabric.Models.FabricCapacityProperties properties = null, Azure.ResourceManager.Fabric.Models.FabricSku sku = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricCapacityProperties FabricCapacityProperties(Azure.ResourceManager.Fabric.Models.FabricProvisioningState? provisioningState = default(Azure.ResourceManager.Fabric.Models.FabricProvisioningState?), Azure.ResourceManager.Fabric.Models.FabricResourceState? state = default(Azure.ResourceManager.Fabric.Models.FabricResourceState?), System.Collections.Generic.IEnumerable administrationMembers = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricNameAvailabilityResult FabricNameAvailabilityResult(bool? isNameAvailable = default(bool?), Azure.ResourceManager.Fabric.Models.FabricNameUnavailableReason? reason = default(Azure.ResourceManager.Fabric.Models.FabricNameUnavailableReason?), string message = null) { throw null; } + public static Azure.ResourceManager.Fabric.Models.FabricQuota FabricQuota(Azure.ResourceManager.Fabric.Models.QuotaName name = null, string unit = null, long currentValue = (long)0, long limit = (long)0) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricSkuDetailsForExistingCapacity FabricSkuDetailsForExistingCapacity(string resourceType = null, Azure.ResourceManager.Fabric.Models.FabricSku sku = null) { throw null; } public static Azure.ResourceManager.Fabric.Models.FabricSkuDetailsForNewCapacity FabricSkuDetailsForNewCapacity(string resourceType = null, string name = null, System.Collections.Generic.IEnumerable locations = null) { throw null; } + public static Azure.ResourceManager.Fabric.Models.QuotaName QuotaName(string value = null, string localizedValue = null) { throw null; } } public partial class FabricCapacityAdministration : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { @@ -211,6 +217,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Fabric.Models.FabricProvisioningState left, Azure.ResourceManager.Fabric.Models.FabricProvisioningState right) { throw null; } public override string ToString() { throw null; } } + public partial class FabricQuota : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal FabricQuota() { } + public long CurrentValue { get { throw null; } } + public long Limit { get { throw null; } } + public Azure.ResourceManager.Fabric.Models.QuotaName Name { get { throw null; } } + public string Unit { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.FabricQuota System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.FabricQuota System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct FabricResourceState : System.IEquatable { @@ -293,4 +313,16 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Fabric.Models.FabricSkuTier left, Azure.ResourceManager.Fabric.Models.FabricSkuTier right) { throw null; } public override string ToString() { throw null; } } + public partial class QuotaName : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QuotaName() { } + public string LocalizedValue { get { throw null; } } + public string Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.QuotaName System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Fabric.Models.QuotaName System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityCollection.cs b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityCollection.cs index b1c27d0f1b41..46bd90876462 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityCollection.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_FabricCapacityCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateOrUpdateACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_CreateOrUpdate.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_CreateOrUpdate.json // this example is just showing the usage of "FabricCapacity_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 @@ -56,7 +56,7 @@ public async Task CreateOrUpdate_CreateOrUpdateACapacity() [Ignore("Only validating compilation of examples")] public async Task Get_GetACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Get.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Get.json // this example is just showing the usage of "FabricCapacity_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -89,7 +89,7 @@ public async Task Get_GetACapacity() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListCapacitiesByResourceGroup() { - // Generated from example definition: 2023-11-01/FabricCapacities_ListByResourceGroup.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_ListByResourceGroup.json // this example is just showing the usage of "FabricCapacity_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 @@ -124,7 +124,7 @@ public async Task GetAll_ListCapacitiesByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Get.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Get.json // this example is just showing the usage of "FabricCapacity_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 @@ -153,7 +153,7 @@ public async Task Exists_GetACapacity() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Get.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Get.json // this example is just showing the usage of "FabricCapacity_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityResource.cs b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityResource.cs index 5e2c7ab6aeea..e009f1dc7148 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityResource.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_FabricCapacityResource.cs @@ -20,7 +20,7 @@ public partial class Sample_FabricCapacityResource [Ignore("Only validating compilation of examples")] public async Task Get_GetACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Get.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Get.json // this example is just showing the usage of "FabricCapacity_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetACapacity() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Delete.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Delete.json // this example is just showing the usage of "FabricCapacity_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_DeleteACapacity() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateCapacityProperties() { - // Generated from example definition: 2023-11-01/FabricCapacities_Update.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Update.json // this example is just showing the usage of "FabricCapacity_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 @@ -116,7 +116,7 @@ public async Task Update_UpdateCapacityProperties() [Ignore("Only validating compilation of examples")] public async Task Resume_ResumeCapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Resume.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Resume.json // this example is just showing the usage of "FabricCapacities_Resume" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -142,7 +142,7 @@ public async Task Resume_ResumeCapacity() [Ignore("Only validating compilation of examples")] public async Task Suspend_SuspendCapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_Suspend.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_Suspend.json // this example is just showing the usage of "FabricCapacities_Suspend" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -168,7 +168,7 @@ public async Task Suspend_SuspendCapacity() [Ignore("Only validating compilation of examples")] public async Task GetSkusForCapacity_ListEligibleSKUsForAnExistingCapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_ListSkusForCapacity.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_ListSkusForCapacity.json // this example is just showing the usage of "FabricCapacities_ListSkusForCapacity" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index e7a09ad2cfea..98d5e5225e06 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetFabricCapacities_ListCapacitiesBySubscription() { - // Generated from example definition: 2023-11-01/FabricCapacities_ListBySubscription.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_ListBySubscription.json // this example is just showing the usage of "FabricCapacity_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 @@ -52,7 +52,7 @@ public async Task GetFabricCapacities_ListCapacitiesBySubscription() [Ignore("Only validating compilation of examples")] public async Task CheckFabricCapacityNameAvailability_CheckNameAvailabilityOfACapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_CheckNameAvailability.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_CheckNameAvailability.json // this example is just showing the usage of "FabricCapacities_CheckFabricCapacityNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task CheckFabricCapacityNameAvailability_CheckNameAvailabilityOfACa [Ignore("Only validating compilation of examples")] public async Task GetSkusFabricCapacities_ListEligibleSKUsForANewCapacity() { - // Generated from example definition: 2023-11-01/FabricCapacities_ListSkus.json + // Generated from example definition: 2025-01-15-preview/FabricCapacities_ListSkus.json // this example is just showing the usage of "FabricCapacities_ListSkus" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -104,5 +104,33 @@ public async Task GetSkusFabricCapacities_ListEligibleSKUsForANewCapacity() Console.WriteLine("Succeeded"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetUsagesFabricCapacities_ListQuotaUsagesForASubscription() + { + // Generated from example definition: 2025-01-15-preview/FabricCapacities_ListUsagesBySubscription.json + // this example is just showing the usage of "FabricCapacities_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 = "548B7FB7-3B2A-4F46-BB02-66473F1FC22C"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + string location = "centraluseuap"; + await foreach (FabricQuota item in subscriptionResource.GetUsagesFabricCapacitiesAsync(location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine("Succeeded"); + } } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/ArmFabricModelFactory.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/ArmFabricModelFactory.cs index 8941166c4928..814f361c9cea 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/ArmFabricModelFactory.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/ArmFabricModelFactory.cs @@ -84,5 +84,25 @@ public static FabricSkuDetailsForNewCapacity FabricSkuDetailsForNewCapacity(stri return new FabricSkuDetailsForNewCapacity(resourceType, name, locations?.ToList(), serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The name of the quota. + /// The unit of usage measurement. + /// The current usage of the resource. + /// The maximum permitted usage of the resource. + /// A new instance for mocking. + public static FabricQuota FabricQuota(QuotaName name = null, string unit = null, long currentValue = default, long limit = default) + { + return new FabricQuota(name, unit, currentValue, limit, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the resource. + /// The localized name of the resource. + /// A new instance for mocking. + public static QuotaName QuotaName(string value = null, string localizedValue = null) + { + return new QuotaName(value, localizedValue, serializedAdditionalRawData: null); + } } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/FabricExtensions.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/FabricExtensions.cs index ed974a30caaf..89f3f3fa3879 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/FabricExtensions.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/FabricExtensions.cs @@ -82,7 +82,7 @@ public static FabricCapacityCollection GetFabricCapacities(this ResourceGroupRes /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -120,7 +120,7 @@ public static async Task> GetFabricCapacityAsyn /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -158,7 +158,7 @@ public static Response GetFabricCapacity(this ResourceGr /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -194,7 +194,7 @@ public static AsyncPageable GetFabricCapacitiesAsync(thi /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -230,7 +230,7 @@ public static Pageable GetFabricCapacities(this Subscrip /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -267,7 +267,7 @@ public static async Task> CheckFabricCapa /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -304,7 +304,7 @@ public static Response CheckFabricCapacityNameAvai /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -340,7 +340,7 @@ public static AsyncPageable GetSkusFabricCapacit /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -362,5 +362,81 @@ public static Pageable GetSkusFabricCapacities(t return GetMockableFabricSubscriptionResource(subscriptionResource).GetSkusFabricCapacities(cancellationToken); } + + /// + /// List the current consumption and limit in this location for the provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages + /// + /// + /// Operation Id + /// FabricCapacities_ListUsages + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetUsagesFabricCapacitiesAsync(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableFabricSubscriptionResource(subscriptionResource).GetUsagesFabricCapacitiesAsync(location, cancellationToken); + } + + /// + /// List the current consumption and limit in this location for the provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages + /// + /// + /// Operation Id + /// FabricCapacities_ListUsages + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetUsagesFabricCapacities(this SubscriptionResource subscriptionResource, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableFabricSubscriptionResource(subscriptionResource).GetUsagesFabricCapacities(location, cancellationToken); + } } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricResourceGroupResource.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricResourceGroupResource.cs index 889c9fd5efe8..3b568590ab79 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricResourceGroupResource.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual FabricCapacityCollection GetFabricCapacities() /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetFabricCapacityAsy /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricSubscriptionResource.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricSubscriptionResource.cs index 713a6f250fc9..4acb11840856 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricSubscriptionResource.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Extensions/MockableFabricSubscriptionResource.cs @@ -55,7 +55,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -85,7 +85,7 @@ public virtual AsyncPageable GetFabricCapacitiesAsync(Ca /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual Pageable GetFabricCapacities(Cancellation /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -158,7 +158,7 @@ public virtual async Task> CheckFabricCap /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -201,7 +201,7 @@ public virtual Response CheckFabricCapacityNameAva /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -231,7 +231,7 @@ public virtual AsyncPageable GetSkusFabricCapaci /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -247,5 +247,75 @@ public virtual Pageable GetSkusFabricCapacities( HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FabricCapacityRestClient.CreateListSkusNextPageRequest(nextLink, Id.SubscriptionId); return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => FabricSkuDetailsForNewCapacity.DeserializeFabricSkuDetailsForNewCapacity(e), FabricCapacityClientDiagnostics, Pipeline, "MockableFabricSubscriptionResource.GetSkusFabricCapacities", "value", "nextLink", cancellationToken); } + + /// + /// List the current consumption and limit in this location for the provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages + /// + /// + /// Operation Id + /// FabricCapacities_ListUsages + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The location name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetUsagesFabricCapacitiesAsync(string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => FabricCapacityRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FabricCapacityRestClient.CreateListUsagesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => FabricQuota.DeserializeFabricQuota(e), FabricCapacityClientDiagnostics, Pipeline, "MockableFabricSubscriptionResource.GetUsagesFabricCapacities", "value", "nextLink", cancellationToken); + } + + /// + /// List the current consumption and limit in this location for the provided subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Fabric/locations/{location}/usages + /// + /// + /// Operation Id + /// FabricCapacities_ListUsages + /// + /// + /// Default Api Version + /// 2025-01-15-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The location name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetUsagesFabricCapacities(string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => FabricCapacityRestClient.CreateListUsagesRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => FabricCapacityRestClient.CreateListUsagesNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => FabricQuota.DeserializeFabricQuota(e), FabricCapacityClientDiagnostics, Pipeline, "MockableFabricSubscriptionResource.GetUsagesFabricCapacities", "value", "nextLink", cancellationToken); + } } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityCollection.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityCollection.cs index db3ef094894a..a26c2e3dcae7 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityCollection.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string capa /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string capacityName, Cancell /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string capacityName, Cance /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string capacityName, CancellationToken canc /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityResource.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityResource.cs index 646a5cf80b01..721decb55e7d 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityResource.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/FabricCapacityResource.cs @@ -104,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -144,7 +144,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -184,7 +184,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -268,7 +268,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -314,7 +314,7 @@ public virtual async Task> UpdateAsync(Wait /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -360,7 +360,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -402,7 +402,7 @@ public virtual async Task ResumeAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -444,7 +444,7 @@ public virtual ArmOperation Resume(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -486,7 +486,7 @@ public virtual async Task SuspendAsync(WaitUntil waitUntil, Cancel /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -528,7 +528,7 @@ public virtual ArmOperation Suspend(WaitUntil waitUntil, CancellationToken cance /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -558,7 +558,7 @@ public virtual AsyncPageable GetSkusForCapa /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -588,7 +588,7 @@ public virtual Pageable GetSkusForCapacity( /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -650,7 +650,7 @@ public virtual async Task> AddTagAsync(string k /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -712,7 +712,7 @@ public virtual Response AddTag(string key, string value, /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -769,7 +769,7 @@ public virtual async Task> SetTagsAsync(IDictio /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -826,7 +826,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource @@ -886,7 +886,7 @@ public virtual async Task> RemoveTagAsync(strin /// /// /// Default Api Version - /// 2023-11-01 + /// 2025-01-15-preview /// /// /// Resource diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.Serialization.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.Serialization.cs new file mode 100644 index 000000000000..3ab7cfb825b0 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.Serialization.cs @@ -0,0 +1,157 @@ +// 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.Fabric.Models +{ + public partial class FabricQuota : 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(FabricQuota)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteObjectValue(Name, options); + } + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit); + writer.WritePropertyName("currentValue"u8); + writer.WriteNumberValue(CurrentValue); + writer.WritePropertyName("limit"u8); + writer.WriteNumberValue(Limit); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + FabricQuota 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(FabricQuota)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFabricQuota(document.RootElement, options); + } + + internal static FabricQuota DeserializeFabricQuota(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + QuotaName name = default; + string unit = default; + long currentValue = default; + long limit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = QuotaName.DeserializeQuotaName(property.Value, options); + continue; + } + if (property.NameEquals("unit"u8)) + { + unit = property.Value.GetString(); + continue; + } + if (property.NameEquals("currentValue"u8)) + { + currentValue = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("limit"u8)) + { + limit = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FabricQuota(name, unit, currentValue, limit, 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(FabricQuota)} does not support writing '{options.Format}' format."); + } + } + + FabricQuota IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeFabricQuota(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FabricQuota)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.cs new file mode 100644 index 000000000000..44b2e23c9f80 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/FabricQuota.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.Fabric.Models +{ + /// Describes Resource Quota. + public partial class FabricQuota + { + /// + /// 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 unit of usage measurement. + /// The current usage of the resource. + /// The maximum permitted usage of the resource. + /// is null. + internal FabricQuota(string unit, long currentValue, long limit) + { + Argument.AssertNotNull(unit, nameof(unit)); + + Unit = unit; + CurrentValue = currentValue; + Limit = limit; + } + + /// Initializes a new instance of . + /// The name of the quota. + /// The unit of usage measurement. + /// The current usage of the resource. + /// The maximum permitted usage of the resource. + /// Keeps track of any properties unknown to the library. + internal FabricQuota(QuotaName name, string unit, long currentValue, long limit, IDictionary serializedAdditionalRawData) + { + Name = name; + Unit = unit; + CurrentValue = currentValue; + Limit = limit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal FabricQuota() + { + } + + /// The name of the quota. + public QuotaName Name { get; } + /// The unit of usage measurement. + public string Unit { get; } + /// The current usage of the resource. + public long CurrentValue { get; } + /// The maximum permitted usage of the resource. + public long Limit { get; } + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.Serialization.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.Serialization.cs new file mode 100644 index 000000000000..65e95624e4a0 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.Serialization.cs @@ -0,0 +1,151 @@ +// 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.Fabric.Models +{ + internal partial class PagedQuota : 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(PagedQuota)} 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + PagedQuota 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(PagedQuota)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePagedQuota(document.RootElement, options); + } + + internal static PagedQuota DeserializePagedQuota(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(FabricQuota.DeserializeFabricQuota(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 PagedQuota(value, nextLink, 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(PagedQuota)} does not support writing '{options.Format}' format."); + } + } + + PagedQuota IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializePagedQuota(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PagedQuota)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.cs new file mode 100644 index 000000000000..9126a94eba10 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/PagedQuota.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Fabric.Models +{ + /// Paged collection of Quota items. + internal partial class PagedQuota + { + /// + /// 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 Quota items on this page. + /// is null. + internal PagedQuota(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Quota items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal PagedQuota(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PagedQuota() + { + } + + /// The Quota items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.Serialization.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.Serialization.cs new file mode 100644 index 000000000000..4580eef46c42 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.Serialization.cs @@ -0,0 +1,140 @@ +// 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.Fabric.Models +{ + public partial class QuotaName : 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(QuotaName)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(LocalizedValue)) + { + writer.WritePropertyName("localizedValue"u8); + writer.WriteStringValue(LocalizedValue); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + QuotaName 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(QuotaName)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQuotaName(document.RootElement, options); + } + + internal static QuotaName DeserializeQuotaName(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + string localizedValue = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("localizedValue"u8)) + { + localizedValue = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QuotaName(value, localizedValue, 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(QuotaName)} does not support writing '{options.Format}' format."); + } + } + + QuotaName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQuotaName(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QuotaName)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.cs new file mode 100644 index 000000000000..2cc074030df6 --- /dev/null +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/Models/QuotaName.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Fabric.Models +{ + /// The Quota Names. + public partial class QuotaName + { + /// + /// 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 QuotaName() + { + } + + /// Initializes a new instance of . + /// The name of the resource. + /// The localized name of the resource. + /// Keeps track of any properties unknown to the library. + internal QuotaName(string value, string localizedValue, IDictionary serializedAdditionalRawData) + { + Value = value; + LocalizedValue = localizedValue; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the resource. + public string Value { get; } + /// The localized name of the resource. + public string LocalizedValue { get; } + } +} diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/RestOperations/FabricCapacitiesRestOperations.cs b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/RestOperations/FabricCapacitiesRestOperations.cs index b51c46a4686a..1f6ede6ea9e0 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/RestOperations/FabricCapacitiesRestOperations.cs +++ b/sdk/fabric/Azure.ResourceManager.Fabric/src/Generated/RestOperations/FabricCapacitiesRestOperations.cs @@ -32,7 +32,7 @@ public FabricCapacitiesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2023-11-01"; + _apiVersion = apiVersion ?? "2025-01-15-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -1000,6 +1000,92 @@ public Response ListSkus(string subscripti } } + internal RequestUriBuilder CreateListUsagesRequestUri(string subscriptionId, string location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Fabric/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListUsagesRequest(string subscriptionId, string 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.Fabric/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/usages", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the current consumption and limit in this location for the provided subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListUsagesAsync(string subscriptionId, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var message = CreateListUsagesRequest(subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PagedQuota value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PagedQuota.DeserializePagedQuota(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the current consumption and limit in this location for the provided subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListUsages(string subscriptionId, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var message = CreateListUsagesRequest(subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PagedQuota value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PagedQuota.DeserializePagedQuota(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(); @@ -1315,5 +1401,85 @@ public Response ListSkusNextPage(string ne throw new RequestFailedException(message.Response); } } + + internal RequestUriBuilder CreateListUsagesNextPageRequestUri(string nextLink, string subscriptionId, string location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListUsagesNextPageRequest(string nextLink, string subscriptionId, string 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 the current consumption and limit in this location for the provided subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListUsagesNextPageAsync(string nextLink, string subscriptionId, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var message = CreateListUsagesNextPageRequest(nextLink, subscriptionId, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + PagedQuota value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = PagedQuota.DeserializePagedQuota(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the current consumption and limit in this location for the provided subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListUsagesNextPage(string nextLink, string subscriptionId, string location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(location, nameof(location)); + + using var message = CreateListUsagesNextPageRequest(nextLink, subscriptionId, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + PagedQuota value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = PagedQuota.DeserializePagedQuota(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/fabric/Azure.ResourceManager.Fabric/tsp-location.yaml b/sdk/fabric/Azure.ResourceManager.Fabric/tsp-location.yaml index 8f804a6ba37f..e898270334bb 100644 --- a/sdk/fabric/Azure.ResourceManager.Fabric/tsp-location.yaml +++ b/sdk/fabric/Azure.ResourceManager.Fabric/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/fabric/Microsoft.Fabric.Management -commit: 7e22a66617633d162735fe65388c2852127b4aac -repo: Azure/azure-rest-api-specs +commit: a3dcf1c9eb0324a1e4e9a12ec4655f54ba1f44f5 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs index 49e4e7fad35a..610ea6bbf58f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AIVisionFaceModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.IO; using System.Linq; namespace Azure.AI.Vision.Face @@ -386,237 +387,204 @@ public static FaceIdentificationCandidate FaceIdentificationCandidate(Guid perso /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// A new instance for mocking. - public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) + public static CreateLivenessSessionContent CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) { return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// A new instance for mocking. - public static CreateLivenessSessionResult CreateLivenessSessionResult(string sessionId = null, string authToken = null) - { - return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness session. /// A new instance for mocking. - public static LivenessSession LivenessSession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null) + public static LivenessSession LivenessSession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, LivenessSessionResults results = null) { return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// The image ID of the session request. - /// The sha256 hash of the verify-image in the request. - /// A new instance for mocking. - public static LivenessSessionAuditEntry LivenessSessionAuditEntry(long id = default, string sessionId = null, string requestId = null, string clientRequestId = null, DateTimeOffset receivedDateTime = default, AuditRequestInfo request = null, AuditLivenessResponseInfo response = null, string digest = null, string sessionImageId = null, string verifyImageHash = null) + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// A new instance for mocking. + public static LivenessSessionResults LivenessSessionResults(IEnumerable attempts = null) { - return new LivenessSessionAuditEntry( - id, - sessionId, - requestId, - clientRequestId, - receivedDateTime, - request, - response, - digest, - sessionImageId, - verifyImageHash, - serializedAdditionalRawData: null); - } + attempts ??= new List(); - /// Initializes a new instance of . - /// The relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The length of the request body in bytes. - /// The content type of the request. - /// The user agent used to submit the request. - /// A new instance for mocking. - public static AuditRequestInfo AuditRequestInfo(string url = null, string method = null, long? contentLength = null, string contentType = null, string userAgent = null) - { - return new AuditRequestInfo( - url, - method, - contentLength, - contentType, - userAgent, - serializedAdditionalRawData: null); + return new LivenessSessionResults(attempts?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// A new instance for mocking. - public static AuditLivenessResponseInfo AuditLivenessResponseInfo(LivenessResponseBody body = null, int statusCode = default, long latencyInMilliseconds = default) + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness call, will be null if there is error. + /// The error of the liveness call, will be null if there is result. + /// A new instance for mocking. + public static LivenessSessionAttempt LivenessSessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessResult result = null, LivenessError error = null) { - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData: null); + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The liveness classification for the target face. - /// Specific targets used for liveness classification. - /// The model version used for liveness classification. - /// The face verification output. Only available when the request is liveness with verify. - /// Additional Properties. - /// A new instance for mocking. - public static LivenessResponseBody LivenessResponseBody(FaceLivenessDecision? livenessDecision = null, LivenessOutputsTarget target = null, LivenessModel? modelVersionUsed = null, LivenessWithVerifyOutputs verifyResult = null, IReadOnlyDictionary additionalProperties = null) + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// A new instance for mocking. + public static LivenessResult LivenessResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null) { - additionalProperties ??= new Dictionary(); - - return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. - /// A new instance for mocking. - public static LivenessOutputsTarget LivenessOutputsTarget(FaceRectangle faceRectangle = null, string fileName = null, int timeOffsetWithinFile = default, FaceImageType imageType = default) + /// Initializes a new instance of . + /// The target from color image used for liveness classification. + /// A new instance for mocking. + public static LivenessDecisionTargets LivenessDecisionTargets(LivenessColorDecisionTarget color = null) { - return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData: null); + return new LivenessDecisionTargets(color, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The detail of face for verification. - /// The target face liveness face and comparison image face verification confidence. - /// Whether the target liveness face and comparison image face match. - /// A new instance for mocking. - public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage = null, float matchConfidence = default, bool isIdentical = default) - { - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The face region where the comparison image's classification was made. - /// Quality of face image for recognition. - /// A new instance for mocking. - public static LivenessWithVerifyImage LivenessWithVerifyImage(FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default) + /// Initializes a new instance of . + /// The face region where the liveness classification was made on. + /// A new instance for mocking. + public static LivenessColorDecisionTarget LivenessColorDecisionTarget(FaceRectangle faceRectangle = null) { - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData: null); + return new LivenessColorDecisionTarget(faceRectangle, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// A new instance for mocking. - public static LivenessSessionItem LivenessSessionItem(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null) + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// Targets used for liveness classification. + /// A new instance for mocking. + public static LivenessError LivenessError(string code = null, string message = null, LivenessDecisionTargets targets = null) { - return new LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - serializedAdditionalRawData: null); + return new LivenessError(code, message, targets, serializedAdditionalRawData: null); } /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// Whether or not return the verify image hash. - /// Threshold for confidence of the face verification. + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. + /// The image stream for verify. Content-Disposition header field for this part must have filename. /// A new instance for mocking. - public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? sendResultsToClient = null, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessSingleModalModel = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null) + public static CreateLivenessWithVerifySessionContent CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode = default, bool? deviceCorrelationIdSetInClient = null, bool? enableSessionImage = null, LivenessModel? livenessModelVersion = null, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, bool? returnVerifyImageHash = null, float? verifyConfidenceThreshold = null, Stream verifyImage = null) { return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, returnVerifyImageHash, verifyConfidenceThreshold, + verifyImage, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// The detail of face for verification. - /// A new instance for mocking. - public static CreateLivenessWithVerifySessionResult CreateLivenessWithVerifySessionResult(string sessionId = null, string authToken = null, LivenessWithVerifyImage verifyImage = null) - { - return new CreateLivenessWithVerifySessionResult(sessionId, authToken, verifyImage, serializedAdditionalRawData: null); - } - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness with verify session. /// A new instance for mocking. - public static LivenessWithVerifySession LivenessWithVerifySession(string id = null, DateTimeOffset createdDateTime = default, DateTimeOffset? sessionStartDateTime = null, bool sessionExpired = default, string deviceCorrelationId = null, int? authTokenTimeToLiveInSeconds = null, FaceSessionStatus status = default, LivenessSessionAuditEntry result = null) + public static LivenessWithVerifySession LivenessWithVerifySession(string sessionId = null, string authToken = null, OperationState status = default, LivenessModel? modelVersion = null, LivenessWithVerifySessionResults results = null) { return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// A new instance for mocking. + public static LivenessWithVerifySessionResults LivenessWithVerifySessionResults(IEnumerable verifyReferences = null, IEnumerable attempts = null) + { + verifyReferences ??= new List(); + attempts ??= new List(); + + return new LivenessWithVerifySessionResults(verifyReferences?.ToList(), attempts?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. + /// The face region where the comparison image's classification was made. + /// Quality of face image for recognition. + /// A new instance for mocking. + public static LivenessWithVerifyReference LivenessWithVerifyReference(FaceImageType referenceType = default, FaceRectangle faceRectangle = null, QualityForRecognition qualityForRecognition = default) + { + return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness with verify call, will be null if there is error. + /// The error of the liveness with verify call, will be null if there is result. + /// A new instance for mocking. + public static LivenessWithVerifySessionAttempt LivenessWithVerifySessionAttempt(int attemptId = default, OperationState attemptStatus = default, LivenessWithVerifyResult result = null, LivenessError error = null) + { + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// The face verification output. Only available when the request is liveness with verify. + /// The sha256 hash of the verify-image in the request. + /// A new instance for mocking. + public static LivenessWithVerifyResult LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision = null, LivenessDecisionTargets targets = null, string digest = null, string sessionImageId = null, LivenessWithVerifyOutputs verifyResult = null, string verifyImageHash = null) + { + return new LivenessWithVerifyResult( + livenessDecision, + targets, + digest, + sessionImageId, + verifyResult, + verifyImageHash, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The target face liveness face and comparison image face verification confidence. + /// Whether the target liveness face and comparison image face match. + /// A new instance for mocking. + public static LivenessWithVerifyOutputs LivenessWithVerifyOutputs(float matchConfidence = default, bool isIdentical = default) + { + return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData: null); + } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.cs deleted file mode 100644 index 3448b284f8e3..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.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.AI.Vision.Face -{ - /// Audit entry for a response in the session. - public partial class AuditLivenessResponseInfo - { - /// - /// 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 response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// is null. - internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds) - { - Argument.AssertNotNull(body, nameof(body)); - - Body = body; - StatusCode = statusCode; - LatencyInMilliseconds = latencyInMilliseconds; - } - - /// Initializes a new instance of . - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - /// The HTTP status code returned to the client. - /// The server measured latency for this request in milliseconds. - /// Keeps track of any properties unknown to the library. - internal AuditLivenessResponseInfo(LivenessResponseBody body, int statusCode, long latencyInMilliseconds, IDictionary serializedAdditionalRawData) - { - Body = body; - StatusCode = statusCode; - LatencyInMilliseconds = latencyInMilliseconds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AuditLivenessResponseInfo() - { - } - - /// The response body. The schema of this field will depend on the request.url and request.method used by the client. - public LivenessResponseBody Body { get; } - /// The HTTP status code returned to the client. - public int StatusCode { get; } - /// The server measured latency for this request in milliseconds. - public long LatencyInMilliseconds { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.cs deleted file mode 100644 index 39356d1eb8f8..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditRequestInfo.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.AI.Vision.Face -{ - /// Audit entry for a request in the session. - public partial class AuditRequestInfo - { - /// - /// 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 relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The content type of the request. - /// , or is null. - internal AuditRequestInfo(string url, string method, string contentType) - { - Argument.AssertNotNull(url, nameof(url)); - Argument.AssertNotNull(method, nameof(method)); - Argument.AssertNotNull(contentType, nameof(contentType)); - - Url = url; - Method = method; - ContentType = contentType; - } - - /// Initializes a new instance of . - /// The relative URL and query of the liveness request. - /// The HTTP method of the request (i.e., GET, POST, DELETE). - /// The length of the request body in bytes. - /// The content type of the request. - /// The user agent used to submit the request. - /// Keeps track of any properties unknown to the library. - internal AuditRequestInfo(string url, string method, long? contentLength, string contentType, string userAgent, IDictionary serializedAdditionalRawData) - { - Url = url; - Method = method; - ContentLength = contentLength; - ContentType = contentType; - UserAgent = userAgent; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal AuditRequestInfo() - { - } - - /// The relative URL and query of the liveness request. - public string Url { get; } - /// The HTTP method of the request (i.e., GET, POST, DELETE). - public string Method { get; } - /// The length of the request body in bytes. - public long? ContentLength { get; } - /// The content type of the request. - public string ContentType { get; } - /// The user agent used to submit the request. - public string UserAgent { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs index a27f25f2a008..6790ac937886 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/AzureAIVisionFaceClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.AI.Vision.Face /// Client options for Azure.AI.Vision.Face library clients. public partial class AzureAIVisionFaceClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V1_2_Preview_1; + private const ServiceVersion LatestVersion = ServiceVersion.V1_2; /// The version of the service to use. public enum ServiceVersion @@ -22,6 +22,8 @@ public enum ServiceVersion V1_1_Preview_1 = 1, /// Service version "v1.2-preview.1". V1_2_Preview_1 = 2, + /// Service version "v1.2". + V1_2 = 3, } internal string Version { get; } @@ -33,6 +35,7 @@ public AzureAIVisionFaceClientOptions(ServiceVersion version = LatestVersion) { ServiceVersion.V1_1_Preview_1 => "v1.1-preview.1", ServiceVersion.V1_2_Preview_1 => "v1.2-preview.1", + ServiceVersion.V1_2 => "v1.2", _ => throw new NotSupportedException() }; } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs index 4c6879d0bbf9..a7d64fe5bb32 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.Serialization.cs @@ -36,11 +36,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("livenessOperationMode"u8); writer.WriteStringValue(LivenessOperationMode.ToString()); - if (Optional.IsDefined(SendResultsToClient)) - { - writer.WritePropertyName("sendResultsToClient"u8); - writer.WriteBooleanValue(SendResultsToClient.Value); - } if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) { writer.WritePropertyName("deviceCorrelationIdSetInClient"u8); @@ -51,10 +46,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enableSessionImage"u8); writer.WriteBooleanValue(EnableSessionImage.Value); } - if (Optional.IsDefined(LivenessSingleModalModel)) + if (Optional.IsDefined(LivenessModelVersion)) { - writer.WritePropertyName("livenessSingleModalModel"u8); - writer.WriteStringValue(LivenessSingleModalModel.Value.ToString()); + writer.WritePropertyName("livenessModelVersion"u8); + writer.WriteStringValue(LivenessModelVersion.Value.ToString()); } if (Optional.IsDefined(DeviceCorrelationId)) { @@ -104,10 +99,9 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon return null; } LivenessOperationMode livenessOperationMode = default; - bool? sendResultsToClient = default; bool? deviceCorrelationIdSetInClient = default; bool? enableSessionImage = default; - LivenessModel? livenessSingleModalModel = default; + LivenessModel? livenessModelVersion = default; string deviceCorrelationId = default; int? authTokenTimeToLiveInSeconds = default; IDictionary serializedAdditionalRawData = default; @@ -119,15 +113,6 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon livenessOperationMode = new LivenessOperationMode(property.Value.GetString()); continue; } - if (property.NameEquals("sendResultsToClient"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sendResultsToClient = property.Value.GetBoolean(); - continue; - } if (property.NameEquals("deviceCorrelationIdSetInClient"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -146,13 +131,13 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon enableSessionImage = property.Value.GetBoolean(); continue; } - if (property.NameEquals("livenessSingleModalModel"u8)) + if (property.NameEquals("livenessModelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - livenessSingleModalModel = new LivenessModel(property.Value.GetString()); + livenessModelVersion = new LivenessModel(property.Value.GetString()); continue; } if (property.NameEquals("deviceCorrelationId"u8)) @@ -177,10 +162,9 @@ internal static CreateLivenessSessionContent DeserializeCreateLivenessSessionCon serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessSessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, serializedAdditionalRawData); diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs index 9de38ee841c6..66e9ce0ec227 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionContent.cs @@ -54,20 +54,18 @@ public CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode) /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// Keeps track of any properties unknown to the library. - internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) + internal CreateLivenessSessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -80,14 +78,12 @@ internal CreateLivenessSessionContent() /// Type of liveness mode the client should follow. public LivenessOperationMode LivenessOperationMode { get; } - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. - public bool? SendResultsToClient { get; set; } /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. public bool? DeviceCorrelationIdSetInClient { get; set; } /// Whether or not store the session image. public bool? EnableSessionImage { get; set; } /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. - public LivenessModel? LivenessSingleModalModel { get; set; } + public LivenessModel? LivenessModelVersion { get; set; } /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. public string DeviceCorrelationId { get; set; } /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.cs deleted file mode 100644 index cf8e5b8e2c7f..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.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.AI.Vision.Face -{ - /// Response of liveness session creation. - public partial class CreateLivenessSessionResult - { - /// - /// 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 unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// or is null. - internal CreateLivenessSessionResult(string sessionId, string authToken) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(authToken, nameof(authToken)); - - SessionId = sessionId; - AuthToken = authToken; - } - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessSessionResult(string sessionId, string authToken, IDictionary serializedAdditionalRawData) - { - SessionId = sessionId; - AuthToken = authToken; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessSessionResult() - { - } - - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - public string SessionId { get; } - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - public string AuthToken { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs index 27a9c425fb45..d3fc29c9d002 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.IO; using System.Text.Json; using Azure.Core; @@ -36,11 +37,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("livenessOperationMode"u8); writer.WriteStringValue(LivenessOperationMode.ToString()); - if (Optional.IsDefined(SendResultsToClient)) - { - writer.WritePropertyName("sendResultsToClient"u8); - writer.WriteBooleanValue(SendResultsToClient.Value); - } if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) { writer.WritePropertyName("deviceCorrelationIdSetInClient"u8); @@ -51,10 +47,10 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("enableSessionImage"u8); writer.WriteBooleanValue(EnableSessionImage.Value); } - if (Optional.IsDefined(LivenessSingleModalModel)) + if (Optional.IsDefined(LivenessModelVersion)) { - writer.WritePropertyName("livenessSingleModalModel"u8); - writer.WriteStringValue(LivenessSingleModalModel.Value.ToString()); + writer.WritePropertyName("livenessModelVersion"u8); + writer.WriteStringValue(LivenessModelVersion.Value.ToString()); } if (Optional.IsDefined(DeviceCorrelationId)) { @@ -76,6 +72,15 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("verifyConfidenceThreshold"u8); writer.WriteNumberValue(VerifyConfidenceThreshold.Value); } + writer.WritePropertyName("verifyImage"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage)); +#else + using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -114,14 +119,14 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness return null; } LivenessOperationMode livenessOperationMode = default; - bool? sendResultsToClient = default; bool? deviceCorrelationIdSetInClient = default; bool? enableSessionImage = default; - LivenessModel? livenessSingleModalModel = default; + LivenessModel? livenessModelVersion = default; string deviceCorrelationId = default; int? authTokenTimeToLiveInSeconds = default; bool? returnVerifyImageHash = default; float? verifyConfidenceThreshold = default; + Stream verifyImage = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -131,15 +136,6 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness livenessOperationMode = new LivenessOperationMode(property.Value.GetString()); continue; } - if (property.NameEquals("sendResultsToClient"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sendResultsToClient = property.Value.GetBoolean(); - continue; - } if (property.NameEquals("deviceCorrelationIdSetInClient"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -158,13 +154,13 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness enableSessionImage = property.Value.GetBoolean(); continue; } - if (property.NameEquals("livenessSingleModalModel"u8)) + if (property.NameEquals("livenessModelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - livenessSingleModalModel = new LivenessModel(property.Value.GetString()); + livenessModelVersion = new LivenessModel(property.Value.GetString()); continue; } if (property.NameEquals("deviceCorrelationId"u8)) @@ -199,6 +195,11 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness verifyConfidenceThreshold = property.Value.GetSingle(); continue; } + if (property.NameEquals("verifyImage"u8)) + { + verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -207,17 +208,68 @@ internal static CreateLivenessWithVerifySessionContent DeserializeCreateLiveness serializedAdditionalRawData = rawDataDictionary; return new CreateLivenessWithVerifySessionContent( livenessOperationMode, - sendResultsToClient, deviceCorrelationIdSetInClient, enableSessionImage, - livenessSingleModalModel, + livenessModelVersion, deviceCorrelationId, authTokenTimeToLiveInSeconds, returnVerifyImageHash, verifyConfidenceThreshold, + verifyImage, serializedAdditionalRawData); } + private BinaryData SerializeMultipart(ModelReaderWriterOptions options) + { + using MultipartFormDataRequestContent content = ToMultipartRequestContent(); + using MemoryStream stream = new MemoryStream(); + content.WriteTo(stream); + if (stream.Position > int.MaxValue) + { + return BinaryData.FromStream(stream); + } + else + { + return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); + } + } + + internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() + { + MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); + content.Add(LivenessOperationMode.ToString(), "livenessOperationMode"); + if (Optional.IsDefined(DeviceCorrelationIdSetInClient)) + { + content.Add(DeviceCorrelationIdSetInClient.Value, "deviceCorrelationIdSetInClient"); + } + if (Optional.IsDefined(EnableSessionImage)) + { + content.Add(EnableSessionImage.Value, "enableSessionImage"); + } + if (Optional.IsDefined(LivenessModelVersion)) + { + content.Add(LivenessModelVersion.Value.ToString(), "livenessModelVersion"); + } + if (Optional.IsDefined(DeviceCorrelationId)) + { + content.Add(DeviceCorrelationId, "deviceCorrelationId"); + } + if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) + { + content.Add(AuthTokenTimeToLiveInSeconds.Value, "authTokenTimeToLiveInSeconds"); + } + if (Optional.IsDefined(ReturnVerifyImageHash)) + { + content.Add(ReturnVerifyImageHash.Value, "returnVerifyImageHash"); + } + if (Optional.IsDefined(VerifyConfidenceThreshold)) + { + content.Add(VerifyConfidenceThreshold.Value, "verifyConfidenceThreshold"); + } + content.Add(VerifyImage, "verifyImage", "verifyImage", "application/octet-stream"); + return content; + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -226,6 +278,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options); + case "MFD": + return SerializeMultipart(options); default: throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionContent)} does not support writing '{options.Format}' format."); } @@ -247,7 +301,7 @@ CreateLivenessWithVerifySessionContent IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs index 99e890eaf7e3..d39fcaf12999 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionContent.cs @@ -7,10 +7,11 @@ using System; using System.Collections.Generic; +using System.IO; namespace Azure.AI.Vision.Face { - /// Request for creating liveness with verify session. + /// Request of liveness with verify session creation. public partial class CreateLivenessWithVerifySessionContent { /// @@ -47,33 +48,38 @@ public partial class CreateLivenessWithVerifySessionContent /// Initializes a new instance of . /// Type of liveness mode the client should follow. - public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode) + /// The image stream for verify. Content-Disposition header field for this part must have filename. + /// is null. + public CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, Stream verifyImage) { + Argument.AssertNotNull(verifyImage, nameof(verifyImage)); + LivenessOperationMode = livenessOperationMode; + VerifyImage = verifyImage; } /// Initializes a new instance of . /// Type of liveness mode the client should follow. - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. /// Whether or not store the session image. - /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. /// Whether or not return the verify image hash. - /// Threshold for confidence of the face verification. + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. + /// The image stream for verify. Content-Disposition header field for this part must have filename. /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? sendResultsToClient, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessSingleModalModel, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, IDictionary serializedAdditionalRawData) + internal CreateLivenessWithVerifySessionContent(LivenessOperationMode livenessOperationMode, bool? deviceCorrelationIdSetInClient, bool? enableSessionImage, LivenessModel? livenessModelVersion, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, bool? returnVerifyImageHash, float? verifyConfidenceThreshold, Stream verifyImage, IDictionary serializedAdditionalRawData) { LivenessOperationMode = livenessOperationMode; - SendResultsToClient = sendResultsToClient; DeviceCorrelationIdSetInClient = deviceCorrelationIdSetInClient; EnableSessionImage = enableSessionImage; - LivenessSingleModalModel = livenessSingleModalModel; + LivenessModelVersion = livenessModelVersion; DeviceCorrelationId = deviceCorrelationId; AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; ReturnVerifyImageHash = returnVerifyImageHash; VerifyConfidenceThreshold = verifyConfidenceThreshold; + VerifyImage = verifyImage; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -84,21 +90,21 @@ internal CreateLivenessWithVerifySessionContent() /// Type of liveness mode the client should follow. public LivenessOperationMode LivenessOperationMode { get; } - /// Whether or not to allow a '200 - Success' response body to be sent to the client, which may be undesirable for security reasons. Default is false, clients will receive a '204 - NoContent' empty body response. Regardless of selection, calling Session GetResult will always contain a response body enabling business logic to be implemented. - public bool? SendResultsToClient { get; set; } /// Whether or not to allow client to set their own 'deviceCorrelationId' via the Vision SDK. Default is false, and 'deviceCorrelationId' must be set in this request body. public bool? DeviceCorrelationIdSetInClient { get; set; } /// Whether or not store the session image. public bool? EnableSessionImage { get; set; } /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. - public LivenessModel? LivenessSingleModalModel { get; set; } + public LivenessModel? LivenessModelVersion { get; set; } /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. public string DeviceCorrelationId { get; set; } /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. public int? AuthTokenTimeToLiveInSeconds { get; set; } /// Whether or not return the verify image hash. public bool? ReturnVerifyImageHash { get; set; } - /// Threshold for confidence of the face verification. + /// Threshold for confidence of the face verification. Please refer to the documentation for more details. https://learn.microsoft.com/legal/cognitive-services/face/characteristics-and-limitations?context=%2Fazure%2Fai-services%2Fcomputer-vision%2Fcontext%2Fcontext#recognition-confidence-score. public float? VerifyConfidenceThreshold { get; set; } + /// The image stream for verify. Content-Disposition header field for this part must have filename. + public Stream VerifyImage { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs deleted file mode 100644 index edc3e7532592..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.Serialization.cs +++ /dev/null @@ -1,183 +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.IO; -using System.Text.Json; -using Azure.Core; - -namespace Azure.AI.Vision.Face -{ - internal partial class CreateLivenessWithVerifySessionMultipartContent : 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(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{format}' format."); - } - - writer.WritePropertyName("Parameters"u8); - writer.WriteObjectValue(Parameters, options); - writer.WritePropertyName("VerifyImage"u8); -#if NET6_0_OR_GREATER - writer.WriteRawValue(global::System.BinaryData.FromStream(VerifyImage)); -#else - using (JsonDocument document = JsonDocument.Parse(BinaryData.FromStream(VerifyImage), ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - } - - CreateLivenessWithVerifySessionMultipartContent 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(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options); - } - - internal static CreateLivenessWithVerifySessionMultipartContent DeserializeCreateLivenessWithVerifySessionMultipartContent(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CreateLivenessWithVerifySessionContent parameters = default; - Stream verifyImage = default; - IDictionary serializedAdditionalRawData = default; - Dictionary rawDataDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("Parameters"u8)) - { - parameters = CreateLivenessWithVerifySessionContent.DeserializeCreateLivenessWithVerifySessionContent(property.Value, options); - continue; - } - if (property.NameEquals("VerifyImage"u8)) - { - verifyImage = BinaryData.FromString(property.Value.GetRawText()).ToStream(); - continue; - } - if (options.Format != "W") - { - rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - } - serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessWithVerifySessionMultipartContent(parameters, verifyImage, serializedAdditionalRawData); - } - - private BinaryData SerializeMultipart(ModelReaderWriterOptions options) - { - using MultipartFormDataRequestContent content = ToMultipartRequestContent(); - using MemoryStream stream = new MemoryStream(); - content.WriteTo(stream); - if (stream.Position > int.MaxValue) - { - return BinaryData.FromStream(stream); - } - else - { - return new BinaryData(stream.GetBuffer().AsMemory(0, (int)stream.Position)); - } - } - - internal virtual MultipartFormDataRequestContent ToMultipartRequestContent() - { - MultipartFormDataRequestContent content = new MultipartFormDataRequestContent(); - content.Add(ModelReaderWriter.Write(Parameters, ModelSerializationExtensions.WireOptions), "Parameters"); - content.Add(VerifyImage, "VerifyImage", "VerifyImage", "application/octet-stream"); - return content; - } - - 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 "MFD": - return SerializeMultipart(options); - default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support writing '{options.Format}' format."); - } - } - - CreateLivenessWithVerifySessionMultipartContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(CreateLivenessWithVerifySessionMultipartContent)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "MFD"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static CreateLivenessWithVerifySessionMultipartContent FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessWithVerifySessionMultipartContent(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.cs deleted file mode 100644 index 972c14733528..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionMultipartContent.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 System.IO; - -namespace Azure.AI.Vision.Face -{ - /// Request of liveness with verify session creation. - internal partial class CreateLivenessWithVerifySessionMultipartContent - { - /// - /// 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 parameters for creating session. - /// The image stream for verify. Content-Disposition header field for this part must have filename. - /// or is null. - public CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage) - { - Argument.AssertNotNull(parameters, nameof(parameters)); - Argument.AssertNotNull(verifyImage, nameof(verifyImage)); - - Parameters = parameters; - VerifyImage = verifyImage; - } - - /// Initializes a new instance of . - /// The parameters for creating session. - /// The image stream for verify. Content-Disposition header field for this part must have filename. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionMultipartContent(CreateLivenessWithVerifySessionContent parameters, Stream verifyImage, IDictionary serializedAdditionalRawData) - { - Parameters = parameters; - VerifyImage = verifyImage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessWithVerifySessionMultipartContent() - { - } - - /// The parameters for creating session. - public CreateLivenessWithVerifySessionContent Parameters { get; } - /// The image stream for verify. Content-Disposition header field for this part must have filename. - public Stream VerifyImage { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.cs deleted file mode 100644 index b969512f54ce..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessWithVerifySessionResult.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.AI.Vision.Face -{ - /// Response of liveness session with verify creation with verify image provided. - public partial class CreateLivenessWithVerifySessionResult - { - /// - /// 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 unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// or is null. - internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(authToken, nameof(authToken)); - - SessionId = sessionId; - AuthToken = authToken; - } - - /// Initializes a new instance of . - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - /// The detail of face for verification. - /// Keeps track of any properties unknown to the library. - internal CreateLivenessWithVerifySessionResult(string sessionId, string authToken, LivenessWithVerifyImage verifyImage, IDictionary serializedAdditionalRawData) - { - SessionId = sessionId; - AuthToken = authToken; - VerifyImage = verifyImage; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal CreateLivenessWithVerifySessionResult() - { - } - - /// The unique session ID of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding Session DELETE operation. - public string SessionId { get; } - /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. - public string AuthToken { get; } - /// The detail of face for verification. - public LivenessWithVerifyImage VerifyImage { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml index 3754a0217479..8103910b8ae4 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/Docs/FaceSessionClient.xml @@ -11,12 +11,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = await client.CreateLivenessSessionAsync(body); +Response response = await client.CreateLivenessSessionAsync(body); ]]> @@ -29,12 +28,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; -Response response = client.CreateLivenessSession(body); +Response response = client.CreateLivenessSession(body); ]]> @@ -48,8 +46,7 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -58,6 +55,9 @@ Response response = await client.CreateLivenessSessionAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -71,8 +71,7 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -81,6 +80,9 @@ Response response = client.CreateLivenessSession(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -142,10 +144,11 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -159,136 +162,85 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = client.GetLivenessSessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> - - -This sample shows how to call GetLivenessSessionsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessSessionsAsync(); -]]> - - - -This sample shows how to call GetLivenessSessions. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessSessions(); -]]> - - - -This sample shows how to call GetLivenessSessionsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessSessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessSessions and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessSessions("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - + -This sample shows how to call GetLivenessSessionAuditEntriesAsync. +This sample shows how to call CreateLivenessWithVerifySessionAsync. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); +CreateLivenessWithVerifySessionContent body = null; +Response response = await client.CreateLivenessWithVerifySessionAsync(body); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntries. +This sample shows how to call CreateLivenessWithVerifySession. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); +CreateLivenessWithVerifySessionContent body = null; +Response response = client.CreateLivenessWithVerifySession(body); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntriesAsync and parse the result. +This sample shows how to call CreateLivenessWithVerifySessionAsync and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); +using RequestContent content = null; +Response response = await client.CreateLivenessWithVerifySessionAsync(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> - + -This sample shows how to call GetLivenessSessionAuditEntries and parse the result. +This sample shows how to call CreateLivenessWithVerifySession and parse the result. "); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); -Response response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); +using RequestContent content = null; +Response response = client.CreateLivenessWithVerifySession(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); +Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -350,10 +302,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> @@ -367,136 +326,17 @@ FaceSessionClient client = new FaceSessionClient(endpoint, credential); Response response = client.GetLivenessWithVerifySessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("createdDateTime").ToString()); -Console.WriteLine(result.GetProperty("sessionExpired").ToString()); +Console.WriteLine(result.GetProperty("sessionId").ToString()); +Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionsAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessWithVerifySessionsAsync(); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessions. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessWithVerifySessions(); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionsAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessWithVerifySessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessions and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessWithVerifySessions("00000000-0000-0000-0000-000000000000", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntries. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntriesAsync and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); -]]> - - - -This sample shows how to call GetLivenessWithVerifySessionAuditEntries and parse the result. -"); -AzureKeyCredential credential = new AzureKeyCredential(""); -FaceSessionClient client = new FaceSessionClient(endpoint, credential); - -Response response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result[0].GetProperty("id").ToString()); -Console.WriteLine(result[0].GetProperty("sessionId").ToString()); -Console.WriteLine(result[0].GetProperty("requestId").ToString()); -Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); -Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); -Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); -Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); -Console.WriteLine(result[0].GetProperty("digest").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); +Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); ]]> diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs index c3695cc5455d..2d54e4f2d175 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionClient.cs @@ -108,14 +108,14 @@ public FaceSessionClient(Uri endpoint, TokenCredential credential, AzureAIVision /// is null. /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details. /// - public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) + public virtual async Task> CreateLivenessSessionAsync(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response response = await CreateLivenessSessionAsync(content, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response); + return Response.FromValue(LivenessSession.FromResponse(response), response); } /// Create a new detect liveness session. @@ -124,14 +124,14 @@ public virtual async Task> CreateLivenessS /// is null. /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-session for more details. /// - public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) + public virtual Response CreateLivenessSession(CreateLivenessSessionContent body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); Response response = CreateLivenessSession(content, context); - return Response.FromValue(CreateLivenessSessionResult.FromResponse(response), response); + return Response.FromValue(LivenessSession.FromResponse(response), response); } /// @@ -336,555 +336,15 @@ public virtual Response GetLivenessSessionResult(string session /// Service returned a non-success status code. /// The response returned from the service. /// - public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists sessions for /detectLiveness/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details. - /// - public virtual async Task>> GetLivenessSessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessSessionsAsync(start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Lists sessions for /detectLiveness/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-sessions for more details. - /// - public virtual Response> GetLivenessSessions(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessSessions(start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// - /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetLivenessSessionsAsync(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Lists sessions for /detectLiveness/SingleModal. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessions(string start, int? top, RequestContext context) - { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessions"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionsRequest(start, top, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task>> GetLivenessSessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessSessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response> GetLivenessSessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessSessionAuditEntries(sessionId, start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task GetLivenessSessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-audit-entries for more details. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual Response GetLivenessSessionAuditEntries(string sessionId, string start, int? top, RequestContext context) - { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionAuditEntries"); - scope.Start(); - try - { - using HttpMessage message = CreateGetLivenessSessionAuditEntriesRequest(sessionId, start, top, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details. - internal virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateLivenessWithVerifySessionAsync(content, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session for more details. - internal virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using RequestContent content = body.ToRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateLivenessWithVerifySession(content, context); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Client device submits VerifyImage during the /detectLivenessWithVerify/singleModal call. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response CreateLivenessWithVerifySession(RequestContent content, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Request content of liveness with verify session creation. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. - internal virtual async Task> CreateLivenessWithVerifySessionWithVerifyImageAsync(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateLivenessWithVerifySessionWithVerifyImageAsync(content, content.ContentType, context).ConfigureAwait(false); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// Create a new liveness session with verify. Provide the verify image during session creation. - /// Request content of liveness with verify session creation. - /// The cancellation token to use. - /// is null. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. - internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(CreateLivenessWithVerifySessionMultipartContent body, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(body, nameof(body)); - - using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateLivenessWithVerifySessionWithVerifyImage(content, content.ContentType, context); - return Response.FromValue(CreateLivenessWithVerifySessionResult.FromResponse(response), response); - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual async Task CreateLivenessWithVerifySessionWithVerifyImageAsync(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// - /// - /// - /// The content to send as the body of the request. - /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// Service returned a non-success status code. - /// The response returned from the service. - internal virtual Response CreateLivenessWithVerifySessionWithVerifyImage(RequestContent content, string contentType, RequestContext context = null) - { - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySessionWithVerifyImage"); - scope.Start(); - try - { - using HttpMessage message = CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(content, contentType, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method - /// - /// [Protocol Method] Delete all session related information for matching the specified session id. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// The unique ID to reference this session. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// Service returned a non-success status code. - /// The response returned from the service. - /// - public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null) + public virtual async Task GetLivenessSessionResultAsync(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); scope.Start(); try { - using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); + using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -894,15 +354,19 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Delete all session related information for matching the specified session id. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-session-result for more details. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// /// /// /// The unique ID to reference this session. @@ -911,16 +375,16 @@ public virtual async Task DeleteLivenessWithVerifySessionAsync(string /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null) + /// + public virtual Response GetLivenessSessionResult(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessSessionResult"); scope.Start(); try { - using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); + using HttpMessage message = CreateGetLivenessSessionResultRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -930,38 +394,40 @@ public virtual Response DeleteLivenessWithVerifySession(string sessionId, Reques } } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. - /// The unique ID to reference this session. + /// Create a new liveness session with verify. Provide the verify image during session creation. + /// Request content of liveness with verify session creation. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default) + /// is null. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. + /// + public virtual async Task> CreateLivenessWithVerifySessionAsync(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(body, nameof(body)); + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false); + Response response = await CreateLivenessWithVerifySessionAsync(content, content.ContentType, context).ConfigureAwait(false); return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. - /// The unique ID to reference this session. + /// Create a new liveness session with verify. Provide the verify image during session creation. + /// Request content of liveness with verify session creation. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default) + /// is null. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/create-liveness-with-verify-session-with-verify-image for more details. + /// + public virtual Response CreateLivenessWithVerifySession(CreateLivenessWithVerifySessionContent body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(body, nameof(body)); + using MultipartFormDataRequestContent content = body.ToMultipartRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessionResult(sessionId, context); + Response response = CreateLivenessWithVerifySession(content, content.ContentType, context); return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. + /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. /// /// /// @@ -970,27 +436,27 @@ public virtual Response GetLivenessWithVerifySessionR /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique ID to reference this session. + /// The content to send as the body of the request. + /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context) + /// + public virtual async Task CreateLivenessWithVerifySessionAsync(RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); + using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1001,7 +467,7 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. + /// [Protocol Method] Create a new liveness session with verify. Provide the verify image during session creation. /// /// /// @@ -1010,27 +476,27 @@ public virtual async Task GetLivenessWithVerifySessionResultAsync(stri /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique ID to reference this session. + /// The content to send as the body of the request. + /// The content type for the operation. Always multipart/form-data for this operation. Allowed values: "multipart/form-data". /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context) + /// + public virtual Response CreateLivenessWithVerifySession(RequestContent content, string contentType, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.CreateLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); + using HttpMessage message = CreateCreateLivenessWithVerifySessionRequest(content, contentType, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1040,76 +506,33 @@ public virtual Response GetLivenessWithVerifySessionResult(string sessionId, Req } } - /// Lists sessions for /detectLivenessWithVerify/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details. - /// - public virtual async Task>> GetLivenessWithVerifySessionsAsync(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionsAsync(start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - - /// Lists sessions for /detectLivenessWithVerify/SingleModal. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. - /// The cancellation token to use. - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-sessions for more details. - /// - public virtual Response> GetLivenessWithVerifySessions(string start = null, int? top = null, CancellationToken cancellationToken = default) - { - RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessions(start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionItem.DeserializeLivenessSessionItem(item)); - } - value = array; - return Response.FromValue(value, response); - } - + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal. + /// [Protocol Method] Delete all session related information for matching the specified session id. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// /// /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. + /// The unique ID to reference this session. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionsAsync(string start, int? top, RequestContext context) + /// + public virtual async Task DeleteLivenessWithVerifySessionAsync(string sessionId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); + Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context); + using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1119,34 +542,33 @@ public virtual async Task GetLivenessWithVerifySessionsAsync(string st } } + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method /// - /// [Protocol Method] Lists sessions for /detectLivenessWithVerify/SingleModal. + /// [Protocol Method] Delete all session related information for matching the specified session id. /// /// /// /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. /// /// - /// - /// - /// Please try the simpler convenience overload with strongly typed models first. - /// - /// /// /// - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. + /// The unique ID to reference this session. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessions(string start, int? top, RequestContext context) + /// + public virtual Response DeleteLivenessWithVerifySession(string sessionId, RequestContext context = null) { - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessions"); + Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); + + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.DeleteLivenessWithVerifySession"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionsRequest(start, top, context); + using HttpMessage message = CreateDeleteLivenessWithVerifySessionRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1156,58 +578,38 @@ public virtual Response GetLivenessWithVerifySessions(string start, int? top, Re } } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task>> GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetLivenessWithVerifySessionResultAsync(string sessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetLivenessWithVerifySessionAuditEntriesAsync(sessionId, start, top, context).ConfigureAwait(false); - IReadOnlyList value = default; - using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); + Response response = await GetLivenessWithVerifySessionResultAsync(sessionId, context).ConfigureAwait(false); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } - /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual Response> GetLivenessWithVerifySessionAuditEntries(string sessionId, string start = null, int? top = null, CancellationToken cancellationToken = default) + /// + public virtual Response GetLivenessWithVerifySessionResult(string sessionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetLivenessWithVerifySessionAuditEntries(sessionId, start, top, context); - IReadOnlyList value = default; - using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - List array = new List(); - foreach (var item in document.RootElement.EnumerateArray()) - { - array.Add(LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(item)); - } - value = array; - return Response.FromValue(value, response); + Response response = GetLivenessWithVerifySessionResult(sessionId, context); + return Response.FromValue(LivenessWithVerifySession.FromResponse(response), response); } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// /// /// @@ -1216,29 +618,27 @@ public virtual Response> GetLivenessWit /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsync(string sessionId, string start, int? top, RequestContext context) + /// + public virtual async Task GetLivenessWithVerifySessionResultAsync(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context); + using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1249,7 +649,7 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn } /// - /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-audit-entries for more details. + /// [Protocol Method] Please refer to https://learn.microsoft.com/rest/api/face/liveness-session-operations/get-liveness-with-verify-session-result for more details. /// /// /// @@ -1258,29 +658,27 @@ public virtual async Task GetLivenessWithVerifySessionAuditEntriesAsyn /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// /// The unique ID to reference this session. - /// List resources greater than the "start". It contains no more than 64 characters. Default is empty. - /// The number of items to list, ranging in [1, 1000]. Default is 1000. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// is null. /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetLivenessWithVerifySessionAuditEntries(string sessionId, string start, int? top, RequestContext context) + /// + public virtual Response GetLivenessWithVerifySessionResult(string sessionId, RequestContext context) { Argument.AssertNotNullOrEmpty(sessionId, nameof(sessionId)); - using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionAuditEntries"); + using var scope = ClientDiagnostics.CreateScope("FaceSessionClient.GetLivenessWithVerifySessionResult"); scope.Start(); try { - using HttpMessage message = CreateGetLivenessWithVerifySessionAuditEntriesRequest(sessionId, start, top, context); + using HttpMessage message = CreateGetLivenessWithVerifySessionResultRequest(sessionId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1563,7 +961,7 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content, uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions", false); + uri.AppendPath("/detectLiveness-sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/json"); @@ -1573,14 +971,14 @@ internal HttpMessage CreateCreateLivenessSessionRequest(RequestContent content, internal HttpMessage CreateDeleteLivenessSessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); + uri.AppendPath("/detectLiveness-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1596,79 +994,14 @@ internal HttpMessage CreateGetLivenessSessionResultRequest(string sessionId, Req uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); - uri.AppendPath(sessionId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessSessionsRequest(string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessSessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLiveness/singleModal/sessions/", false); + uri.AppendPath("/detectLiveness-sessions/", false); uri.AppendPath(sessionId, true); - uri.AppendPath("/audit", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; return message; } - internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest(RequestContent content, string contentType, RequestContext context) + internal HttpMessage CreateCreateLivenessWithVerifySessionRequest(RequestContent content, string contentType, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -1677,7 +1010,7 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); + uri.AppendPath("/detectLivenessWithVerify-sessions", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", contentType); @@ -1687,14 +1020,14 @@ internal HttpMessage CreateCreateLivenessWithVerifySessionWithVerifyImageRequest internal HttpMessage CreateDeleteLivenessWithVerifySessionRequest(string sessionId, RequestContext context) { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -1710,56 +1043,8 @@ internal HttpMessage CreateGetLivenessWithVerifySessionResultRequest(string sess uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); - uri.AppendPath(sessionId, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionsRequest(string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - internal HttpMessage CreateGetLivenessWithVerifySessionAuditEntriesRequest(string sessionId, string start, int? top, RequestContext context) - { - var message = _pipeline.CreateMessage(context, ResponseClassifier200); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(_endpoint); - uri.AppendRaw("/face/", false); - uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/detectLivenessWithVerify/singleModal/sessions/", false); + uri.AppendPath("/detectLivenessWithVerify-sessions/", false); uri.AppendPath(sessionId, true); - uri.AppendPath("/audit", false); - if (start != null) - { - uri.AppendQuery("start", start, true); - } - if (top != null) - { - uri.AppendQuery("top", top.Value, true); - } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; @@ -1819,7 +1104,7 @@ internal HttpMessage CreateGetSessionImageRequest(string sessionImageId, Request uri.Reset(_endpoint); uri.AppendRaw("/face/", false); uri.AppendRaw(_apiVersion, true); - uri.AppendPath("/session/sessionImages/", false); + uri.AppendPath("/sessionImages/", false); uri.AppendPath(sessionImageId, true); request.Uri = uri; request.Headers.Add("Accept", "application/octet-stream"); @@ -1839,5 +1124,7 @@ internal static RequestContext FromCancellationToken(CancellationToken cancellat private static ResponseClassifier _responseClassifier200; private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.cs deleted file mode 100644 index 6c583b333353..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/FaceSessionStatus.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.AI.Vision.Face -{ - /// The current status of the session. - public readonly partial struct FaceSessionStatus : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public FaceSessionStatus(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string NotStartedValue = "NotStarted"; - private const string StartedValue = "Started"; - private const string ResultAvailableValue = "ResultAvailable"; - - /// Session has not started. - public static FaceSessionStatus NotStarted { get; } = new FaceSessionStatus(NotStartedValue); - /// Session has started. - public static FaceSessionStatus Started { get; } = new FaceSessionStatus(StartedValue); - /// Session has available result. - public static FaceSessionStatus ResultAvailable { get; } = new FaceSessionStatus(ResultAvailableValue); - /// Determines if two values are the same. - public static bool operator ==(FaceSessionStatus left, FaceSessionStatus right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(FaceSessionStatus left, FaceSessionStatus right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator FaceSessionStatus(string value) => new FaceSessionStatus(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is FaceSessionStatus other && Equals(other); - /// - public bool Equals(FaceSessionStatus 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/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs index cfbbbbc33e22..89cf1ece8d4f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargeFaceListClient.cs @@ -49,7 +49,7 @@ protected LargeFaceListClient() /// https://{resource-name}.cognitiveservices.azure.com). /// /// Valid character is letter in lower case or digit or '-' or '_', maximum length is 64. - /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1". + /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2". internal LargeFaceListClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largeFaceListId, string apiVersion) { ClientDiagnostics = clientDiagnostics; diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs index e65069cb45e1..76ab2dea7f22 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LargePersonGroupClient.cs @@ -49,7 +49,7 @@ protected LargePersonGroupClient() /// https://{resource-name}.cognitiveservices.azure.com). /// /// ID of the container. - /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1". + /// API Version. Allowed values: "v1.1-preview.1" | "v1.2-preview.1" | "v1.2". internal LargePersonGroupClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, AzureKeyCredential keyCredential, TokenCredential tokenCredential, Uri endpoint, string largePersonGroupId, string apiVersion) { ClientDiagnostics = clientDiagnostics; diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs similarity index 65% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs index 15b072f6e4b7..f7ba4a27e38d 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/CreateLivenessSessionResult.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class CreateLivenessSessionResult : IUtf8JsonSerializable, IJsonModel + public partial class LivenessColorDecisionTarget : 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,16 +28,14 @@ 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(CreateLivenessSessionResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{format}' format."); } - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("authToken"u8); - writer.WriteStringValue(AuthToken); + writer.WritePropertyName("faceRectangle"u8); + writer.WriteObjectValue(FaceRectangle, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -55,19 +53,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - CreateLivenessSessionResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessColorDecisionTarget 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(CreateLivenessSessionResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeCreateLivenessSessionResult(document.RootElement, options); + return DeserializeLivenessColorDecisionTarget(document.RootElement, options); } - internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessColorDecisionTarget DeserializeLivenessColorDecisionTarget(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,20 +73,14 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu { return null; } - string sessionId = default; - string authToken = default; + FaceRectangle faceRectangle = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("sessionId"u8)) + if (property.NameEquals("faceRectangle"u8)) { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("authToken"u8)) - { - authToken = property.Value.GetString(); + faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); continue; } if (options.Format != "W") @@ -97,46 +89,46 @@ internal static CreateLivenessSessionResult DeserializeCreateLivenessSessionResu } } serializedAdditionalRawData = rawDataDictionary; - return new CreateLivenessSessionResult(sessionId, authToken, serializedAdditionalRawData); + return new LivenessColorDecisionTarget(faceRectangle, 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(CreateLivenessSessionResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support writing '{options.Format}' format."); } } - CreateLivenessSessionResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessColorDecisionTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessSessionResult(document.RootElement, options); + return DeserializeLivenessColorDecisionTarget(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(CreateLivenessSessionResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessColorDecisionTarget)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static CreateLivenessSessionResult FromResponse(Response response) + internal static LivenessColorDecisionTarget FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeCreateLivenessSessionResult(document.RootElement); + return DeserializeLivenessColorDecisionTarget(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs similarity index 51% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs index 4469cf9f8d50..9a04763a6e3d 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessColorDecisionTarget.cs @@ -10,8 +10,8 @@ namespace Azure.AI.Vision.Face { - /// The liveness classification for target face. - public partial class LivenessOutputsTarget + /// The target from color image used for liveness classification. + public partial class LivenessColorDecisionTarget { /// /// Keeps track of any properties unknown to the library. @@ -45,50 +45,31 @@ public partial class LivenessOutputsTarget /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. - /// or is null. - internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType) + /// is null. + internal LivenessColorDecisionTarget(FaceRectangle faceRectangle) { Argument.AssertNotNull(faceRectangle, nameof(faceRectangle)); - Argument.AssertNotNull(fileName, nameof(fileName)); FaceRectangle = faceRectangle; - FileName = fileName; - TimeOffsetWithinFile = timeOffsetWithinFile; - ImageType = imageType; } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The face region where the liveness classification was made on. - /// The file name which contains the face rectangle where the liveness classification was made on. - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - /// The image type which contains the face rectangle where the liveness classification was made on. /// Keeps track of any properties unknown to the library. - internal LivenessOutputsTarget(FaceRectangle faceRectangle, string fileName, int timeOffsetWithinFile, FaceImageType imageType, IDictionary serializedAdditionalRawData) + internal LivenessColorDecisionTarget(FaceRectangle faceRectangle, IDictionary serializedAdditionalRawData) { FaceRectangle = faceRectangle; - FileName = fileName; - TimeOffsetWithinFile = timeOffsetWithinFile; - ImageType = imageType; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal LivenessOutputsTarget() + /// Initializes a new instance of for deserialization. + internal LivenessColorDecisionTarget() { } /// The face region where the liveness classification was made on. public FaceRectangle FaceRectangle { get; } - /// The file name which contains the face rectangle where the liveness classification was made on. - public string FileName { get; } - /// The time offset within the file of the frame which contains the face rectangle where the liveness classification was made on. - public int TimeOffsetWithinFile { get; } - /// The image type which contains the face rectangle where the liveness classification was made on. - public FaceImageType ImageType { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs new file mode 100644 index 000000000000..20ea28c7a099 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.Serialization.cs @@ -0,0 +1,142 @@ +// 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.AI.Vision.Face +{ + public partial class LivenessDecisionTargets : 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(LivenessDecisionTargets)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("color"u8); + writer.WriteObjectValue(Color, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessDecisionTargets 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(LivenessDecisionTargets)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessDecisionTargets(document.RootElement, options); + } + + internal static LivenessDecisionTargets DeserializeLivenessDecisionTargets(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LivenessColorDecisionTarget color = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("color"u8)) + { + color = LivenessColorDecisionTarget.DeserializeLivenessColorDecisionTarget(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessDecisionTargets(color, 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(LivenessDecisionTargets)} does not support writing '{options.Format}' format."); + } + } + + LivenessDecisionTargets IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessDecisionTargets(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessDecisionTargets)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessDecisionTargets FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessDecisionTargets(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs new file mode 100644 index 000000000000..8e64b0560f73 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessDecisionTargets.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The targets used for liveness classification. + public partial class LivenessDecisionTargets + { + /// + /// 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 target from color image used for liveness classification. + /// is null. + internal LivenessDecisionTargets(LivenessColorDecisionTarget color) + { + Argument.AssertNotNull(color, nameof(color)); + + Color = color; + } + + /// Initializes a new instance of . + /// The target from color image used for liveness classification. + /// Keeps track of any properties unknown to the library. + internal LivenessDecisionTargets(LivenessColorDecisionTarget color, IDictionary serializedAdditionalRawData) + { + Color = color; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessDecisionTargets() + { + } + + /// The target from color image used for liveness classification. + public LivenessColorDecisionTarget Color { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs similarity index 57% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs index 3d4f997e8429..617f0c01c590 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/AuditLivenessResponseInfo.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class AuditLivenessResponseInfo : IUtf8JsonSerializable, IJsonModel + public partial class LivenessError : 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,18 +28,18 @@ 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(AuditLivenessResponseInfo)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{format}' format."); } - writer.WritePropertyName("body"u8); - writer.WriteObjectValue(Body, options); - writer.WritePropertyName("statusCode"u8); - writer.WriteNumberValue(StatusCode); - writer.WritePropertyName("latencyInMilliseconds"u8); - writer.WriteNumberValue(LatencyInMilliseconds); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -57,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - AuditLivenessResponseInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessError 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(AuditLivenessResponseInfo)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeAuditLivenessResponseInfo(document.RootElement, options); + return DeserializeLivenessError(document.RootElement, options); } - internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessError DeserializeLivenessError(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -77,26 +77,26 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J { return null; } - LivenessResponseBody body = default; - int statusCode = default; - long latencyInMilliseconds = default; + string code = default; + string message = default; + LivenessDecisionTargets targets = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("body"u8)) + if (property.NameEquals("code"u8)) { - body = LivenessResponseBody.DeserializeLivenessResponseBody(property.Value, options); + code = property.Value.GetString(); continue; } - if (property.NameEquals("statusCode"u8)) + if (property.NameEquals("message"u8)) { - statusCode = property.Value.GetInt32(); + message = property.Value.GetString(); continue; } - if (property.NameEquals("latencyInMilliseconds"u8)) + if (property.NameEquals("targets"u8)) { - latencyInMilliseconds = property.Value.GetInt64(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (options.Format != "W") @@ -105,46 +105,46 @@ internal static AuditLivenessResponseInfo DeserializeAuditLivenessResponseInfo(J } } serializedAdditionalRawData = rawDataDictionary; - return new AuditLivenessResponseInfo(body, statusCode, latencyInMilliseconds, serializedAdditionalRawData); + return new LivenessError(code, message, targets, 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(AuditLivenessResponseInfo)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support writing '{options.Format}' format."); } } - AuditLivenessResponseInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessError IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditLivenessResponseInfo(document.RootElement, options); + return DeserializeLivenessError(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(AuditLivenessResponseInfo)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessError)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static AuditLivenessResponseInfo FromResponse(Response response) + internal static LivenessError FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeAuditLivenessResponseInfo(document.RootElement); + return DeserializeLivenessError(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs new file mode 100644 index 000000000000..4b38aa3b7260 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessError.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The error of the liveness classification. + public partial class LivenessError + { + /// + /// 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 error code. + /// The error message. + /// Targets used for liveness classification. + /// , or is null. + internal LivenessError(string code, string message, LivenessDecisionTargets targets) + { + Argument.AssertNotNull(code, nameof(code)); + Argument.AssertNotNull(message, nameof(message)); + Argument.AssertNotNull(targets, nameof(targets)); + + Code = code; + Message = message; + Targets = targets; + } + + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// Targets used for liveness classification. + /// Keeps track of any properties unknown to the library. + internal LivenessError(string code, string message, LivenessDecisionTargets targets, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + Targets = targets; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessError() + { + } + + /// The error code. + public string Code { get; } + /// The error message. + public string Message { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs index f5a0af9fc967..8cf63b931713 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessModel.cs @@ -22,13 +22,10 @@ public LivenessModel(string value) _value = value ?? throw new ArgumentNullException(nameof(value)); } - private const string V20221015Preview04Value = "2022-10-15-preview.04"; - private const string V20231220Preview06Value = "2023-12-20-preview.06"; + private const string V20241115Value = "2024-11-15"; - /// 2022-10-15-preview.04. - public static LivenessModel V20221015Preview04 { get; } = new LivenessModel(V20221015Preview04Value); - /// 2023-12-20-preview.06. - public static LivenessModel V20231220Preview06 { get; } = new LivenessModel(V20231220Preview06Value); + /// 2024-11-15. + public static LivenessModel V20241115 { get; } = new LivenessModel(V20241115Value); /// Determines if two values are the same. public static bool operator ==(LivenessModel left, LivenessModel right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.Serialization.cs deleted file mode 100644 index 02ee779e066f..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.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.Json; -using Azure.Core; - -namespace Azure.AI.Vision.Face -{ - public partial class LivenessResponseBody : 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(LivenessResponseBody)} does not support writing '{format}' format."); - } - - if (Optional.IsDefined(LivenessDecision)) - { - writer.WritePropertyName("livenessDecision"u8); - writer.WriteStringValue(LivenessDecision.Value.ToString()); - } - if (Optional.IsDefined(Target)) - { - writer.WritePropertyName("target"u8); - writer.WriteObjectValue(Target, options); - } - if (Optional.IsDefined(ModelVersionUsed)) - { - writer.WritePropertyName("modelVersionUsed"u8); - writer.WriteStringValue(ModelVersionUsed.Value.ToString()); - } - if (Optional.IsDefined(VerifyResult)) - { - writer.WritePropertyName("verifyResult"u8); - writer.WriteObjectValue(VerifyResult, options); - } - foreach (var item in AdditionalProperties) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - - LivenessResponseBody 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(LivenessResponseBody)} does not support reading '{format}' format."); - } - - using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessResponseBody(document.RootElement, options); - } - - internal static LivenessResponseBody DeserializeLivenessResponseBody(JsonElement element, ModelReaderWriterOptions options = null) - { - options ??= ModelSerializationExtensions.WireOptions; - - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - FaceLivenessDecision? livenessDecision = default; - LivenessOutputsTarget target = default; - LivenessModel? modelVersionUsed = default; - LivenessWithVerifyOutputs verifyResult = default; - IReadOnlyDictionary additionalProperties = default; - Dictionary additionalPropertiesDictionary = new Dictionary(); - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("livenessDecision"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - livenessDecision = new FaceLivenessDecision(property.Value.GetString()); - continue; - } - if (property.NameEquals("target"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - target = LivenessOutputsTarget.DeserializeLivenessOutputsTarget(property.Value, options); - continue; - } - if (property.NameEquals("modelVersionUsed"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modelVersionUsed = new LivenessModel(property.Value.GetString()); - continue; - } - if (property.NameEquals("verifyResult"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); - continue; - } - additionalPropertiesDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); - } - additionalProperties = additionalPropertiesDictionary; - return new LivenessResponseBody(livenessDecision, target, modelVersionUsed, verifyResult, additionalProperties); - } - - 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(LivenessResponseBody)} does not support writing '{options.Format}' format."); - } - } - - LivenessResponseBody IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) - { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; - - switch (format) - { - case "J": - { - using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessResponseBody(document.RootElement, options); - } - default: - throw new FormatException($"The model {nameof(LivenessResponseBody)} does not support reading '{options.Format}' format."); - } - } - - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static LivenessResponseBody FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessResponseBody(document.RootElement); - } - - /// Convert into a . - internal virtual RequestContent ToRequestContent() - { - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); - return content; - } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.cs deleted file mode 100644 index 5d831412b0a9..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResponseBody.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; - -namespace Azure.AI.Vision.Face -{ - /// The response body of detect liveness API call. - public partial class LivenessResponseBody - { - /// Initializes a new instance of . - internal LivenessResponseBody() - { - AdditionalProperties = new ChangeTrackingDictionary(); - } - - /// Initializes a new instance of . - /// The liveness classification for the target face. - /// Specific targets used for liveness classification. - /// The model version used for liveness classification. - /// The face verification output. Only available when the request is liveness with verify. - /// Additional Properties. - internal LivenessResponseBody(FaceLivenessDecision? livenessDecision, LivenessOutputsTarget target, LivenessModel? modelVersionUsed, LivenessWithVerifyOutputs verifyResult, IReadOnlyDictionary additionalProperties) - { - LivenessDecision = livenessDecision; - Target = target; - ModelVersionUsed = modelVersionUsed; - VerifyResult = verifyResult; - AdditionalProperties = additionalProperties; - } - - /// The liveness classification for the target face. - public FaceLivenessDecision? LivenessDecision { get; } - /// Specific targets used for liveness classification. - public LivenessOutputsTarget Target { get; } - /// The model version used for liveness classification. - public LivenessModel? ModelVersionUsed { get; } - /// The face verification output. Only available when the request is liveness with verify. - public LivenessWithVerifyOutputs VerifyResult { get; } - /// - /// Additional Properties - /// - /// 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" }. - /// - /// - /// - /// - public IReadOnlyDictionary AdditionalProperties { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs index fe769e9deb54..6a386a5fd74b 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessOutputsTarget.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessOutputsTarget : IUtf8JsonSerializable, IJsonModel + public partial class LivenessResult : 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,20 +28,26 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderW /// 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(LivenessOutputsTarget)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("faceRectangle"u8); - writer.WriteObjectValue(FaceRectangle, options); - writer.WritePropertyName("fileName"u8); - writer.WriteStringValue(FileName); - writer.WritePropertyName("timeOffsetWithinFile"u8); - writer.WriteNumberValue(TimeOffsetWithinFile); - writer.WritePropertyName("imageType"u8); - writer.WriteStringValue(ImageType.ToString()); + if (Optional.IsDefined(LivenessDecision)) + { + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); + } + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); + writer.WritePropertyName("digest"u8); + writer.WriteStringValue(Digest); + if (Optional.IsDefined(SessionImageId)) + { + writer.WritePropertyName("sessionImageId"u8); + writer.WriteStringValue(SessionImageId); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -59,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessOutputsTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessResult 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(LivenessOutputsTarget)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } - internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessResult DeserializeLivenessResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -79,32 +85,36 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme { return null; } - FaceRectangle faceRectangle = default; - string fileName = default; - int timeOffsetWithinFile = default; - FaceImageType imageType = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; + string digest = default; + string sessionImageId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("faceRectangle"u8)) + if (property.NameEquals("livenessDecision"u8)) { - faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("fileName"u8)) + if (property.NameEquals("targets"u8)) { - fileName = property.Value.GetString(); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } - if (property.NameEquals("timeOffsetWithinFile"u8)) + if (property.NameEquals("digest"u8)) { - timeOffsetWithinFile = property.Value.GetInt32(); + digest = property.Value.GetString(); continue; } - if (property.NameEquals("imageType"u8)) + if (property.NameEquals("sessionImageId"u8)) { - imageType = new FaceImageType(property.Value.GetString()); + sessionImageId = property.Value.GetString(); continue; } if (options.Format != "W") @@ -113,46 +123,46 @@ internal static LivenessOutputsTarget DeserializeLivenessOutputsTarget(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessOutputsTarget(faceRectangle, fileName, timeOffsetWithinFile, imageType, serializedAdditionalRawData); + return new LivenessResult(livenessDecision, targets, digest, sessionImageId, 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(LivenessOutputsTarget)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support writing '{options.Format}' format."); } } - LivenessOutputsTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessOutputsTarget(document.RootElement, options); + return DeserializeLivenessResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessOutputsTarget)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessOutputsTarget FromResponse(Response response) + internal static LivenessResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessOutputsTarget(document.RootElement); + return DeserializeLivenessResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs new file mode 100644 index 000000000000..cf20e1fdeca9 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessResult.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness classification. + public partial class LivenessResult + { + /// + /// 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 . + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// or is null. + internal LivenessResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// Keeps track of any properties unknown to the library. + internal LivenessResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs index 64b251d3ced0..0513d2d422a9 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.Serialization.cs @@ -36,35 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + LivenessSessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessSessionResults.DeserializeLivenessSessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +132,11 @@ internal static LivenessSession DeserializeLivenessSession(JsonElement element, } serializedAdditionalRawData = rawDataDictionary; return new LivenessSession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs index bda0898e67ff..7a073ee5cd14 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSession.cs @@ -46,36 +46,34 @@ public partial class LivenessSession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - internal LivenessSession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness session. + /// or is null. + internal LivenessSession(string authToken, OperationState status, LivenessSessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness session. /// Keeps track of any properties unknown to the library. - internal LivenessSession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessSession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, LivenessSessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ internal LivenessSession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + public string SessionId { get; } + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. + public string AuthToken { get; } /// The current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + public LivenessModel? ModelVersion { get; } + /// The results of the liveness session. + public LivenessSessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs new file mode 100644 index 000000000000..35f22ed2bb12 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.Serialization.cs @@ -0,0 +1,180 @@ +// 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.AI.Vision.Face +{ + public partial class LivenessSessionAttempt : 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(LivenessSessionAttempt)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) + { + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessSessionAttempt 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(LivenessSessionAttempt)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionAttempt(document.RootElement, options); + } + + internal static LivenessSessionAttempt DeserializeLivenessSessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int attemptId = default; + OperationState attemptStatus = default; + LivenessResult result = default; + LivenessError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attemptId"u8)) + { + attemptId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("attemptStatus"u8)) + { + attemptStatus = new OperationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("result"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + result = LivenessResult.DeserializeLivenessResult(property.Value, options); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = LivenessError.DeserializeLivenessError(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionAttempt(attemptId, attemptStatus, result, error, 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(LivenessSessionAttempt)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionAttempt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionAttempt(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionAttempt)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessSessionAttempt FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionAttempt(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs new file mode 100644 index 000000000000..0f414f5127d8 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAttempt.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The liveness session attempt. + public partial class LivenessSessionAttempt + { + /// + /// 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 attempt ID, start from 1. + /// The status of the attempt. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness call, will be null if there is error. + /// The error of the liveness call, will be null if there is result. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionAttempt(int attemptId, OperationState attemptStatus, LivenessResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness call, will be null if there is error. + public LivenessResult Result { get; } + /// The error of the liveness call, will be null if there is result. + public LivenessError Error { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs deleted file mode 100644 index 46b364a13ffd..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; - -namespace Azure.AI.Vision.Face -{ - /// Audit entry for a request in session. - public partial class LivenessSessionAuditEntry - { - /// - /// 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 unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// , , , , or is null. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest) - { - Argument.AssertNotNull(sessionId, nameof(sessionId)); - Argument.AssertNotNull(requestId, nameof(requestId)); - Argument.AssertNotNull(clientRequestId, nameof(clientRequestId)); - Argument.AssertNotNull(request, nameof(request)); - Argument.AssertNotNull(response, nameof(response)); - Argument.AssertNotNull(digest, nameof(digest)); - - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - } - - /// Initializes a new instance of . - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - /// The UTC DateTime that the request was received. - /// The request of this entry. - /// The response of this entry. - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - /// The image ID of the session request. - /// The sha256 hash of the verify-image in the request. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionAuditEntry(long id, string sessionId, string requestId, string clientRequestId, DateTimeOffset receivedDateTime, AuditRequestInfo request, AuditLivenessResponseInfo response, string digest, string sessionImageId, string verifyImageHash, IDictionary serializedAdditionalRawData) - { - Id = id; - SessionId = sessionId; - RequestId = requestId; - ClientRequestId = clientRequestId; - ReceivedDateTime = receivedDateTime; - Request = request; - Response = response; - Digest = digest; - SessionImageId = sessionImageId; - VerifyImageHash = verifyImageHash; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionAuditEntry() - { - } - - /// The unique id to refer to this audit request. Use this id with the 'start' query parameter to continue on to the next page of audit results. - public long Id { get; } - /// The unique sessionId of the created session. It will expire 48 hours after it was created or may be deleted sooner using the corresponding session DELETE operation. - public string SessionId { get; } - /// The unique requestId that is returned by the service to the client in the 'apim-request-id' header. - public string RequestId { get; } - /// The unique clientRequestId that is sent by the client in the 'client-request-id' header. - public string ClientRequestId { get; } - /// The UTC DateTime that the request was received. - public DateTimeOffset ReceivedDateTime { get; } - /// The request of this entry. - public AuditRequestInfo Request { get; } - /// The response of this entry. - public AuditLivenessResponseInfo Response { get; } - /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. - public string Digest { get; } - /// The image ID of the session request. - public string SessionImageId { get; } - /// The sha256 hash of the verify-image in the request. - public string VerifyImageHash { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.cs deleted file mode 100644 index e46e4901a8a1..000000000000 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.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.AI.Vision.Face -{ - /// Session data returned for enumeration. - public partial class LivenessSessionItem - { - /// - /// 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 . - /// DateTime when this session was created. - /// Whether or not the session is expired. - internal LivenessSessionItem(DateTimeOffset createdDateTime, bool sessionExpired) - { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; - } - - /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - /// Keeps track of any properties unknown to the library. - internal LivenessSessionItem(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, IDictionary serializedAdditionalRawData) - { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; - _serializedAdditionalRawData = serializedAdditionalRawData; - } - - /// Initializes a new instance of for deserialization. - internal LivenessSessionItem() - { - } - - /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } - } -} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs new file mode 100644 index 000000000000..75f8162577e8 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.Serialization.cs @@ -0,0 +1,152 @@ +// 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.AI.Vision.Face +{ + public partial class LivenessSessionResults : 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(LivenessSessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessSessionResults 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(LivenessSessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessSessionResults(document.RootElement, options); + } + + internal static LivenessSessionResults DeserializeLivenessSessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessSessionAttempt.DeserializeLivenessSessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessSessionResults(attempts, 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(LivenessSessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessSessionResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessSessionResults)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessSessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessSessionResults(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs new file mode 100644 index 000000000000..1a3686a45577 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionResults.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness session. + public partial class LivenessSessionResults + { + /// + /// 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 attempts data of underlying liveness call with the session. + /// is null. + internal LivenessSessionResults(IEnumerable attempts) + { + Argument.AssertNotNull(attempts, nameof(attempts)); + + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The attempts data of underlying liveness call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessSessionResults(IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessSessionResults() + { + } + + /// The attempts data of underlying liveness call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs index f82efb60a43d..79f11aaffbd3 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.Serialization.cs @@ -34,8 +34,6 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(LivenessWithVerifyOutputs)} does not support writing '{format}' format."); } - writer.WritePropertyName("verifyImage"u8); - writer.WriteObjectValue(VerifyImage, options); writer.WritePropertyName("matchConfidence"u8); writer.WriteNumberValue(MatchConfidence); writer.WritePropertyName("isIdentical"u8); @@ -77,18 +75,12 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J { return null; } - LivenessWithVerifyImage verifyImage = default; float matchConfidence = default; bool isIdentical = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("verifyImage"u8)) - { - verifyImage = LivenessWithVerifyImage.DeserializeLivenessWithVerifyImage(property.Value, options); - continue; - } if (property.NameEquals("matchConfidence"u8)) { matchConfidence = property.Value.GetSingle(); @@ -105,7 +97,7 @@ internal static LivenessWithVerifyOutputs DeserializeLivenessWithVerifyOutputs(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyOutputs(verifyImage, matchConfidence, isIdentical, serializedAdditionalRawData); + return new LivenessWithVerifyOutputs(matchConfidence, isIdentical, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs index 45c6d6405b7f..3abf91ab403f 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyOutputs.cs @@ -46,27 +46,20 @@ public partial class LivenessWithVerifyOutputs private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// The detail of face for verification. /// The target face liveness face and comparison image face verification confidence. /// Whether the target liveness face and comparison image face match. - /// is null. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical) { - Argument.AssertNotNull(verifyImage, nameof(verifyImage)); - - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; } /// Initializes a new instance of . - /// The detail of face for verification. /// The target face liveness face and comparison image face verification confidence. /// Whether the target liveness face and comparison image face match. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyOutputs(LivenessWithVerifyImage verifyImage, float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyOutputs(float matchConfidence, bool isIdentical, IDictionary serializedAdditionalRawData) { - VerifyImage = verifyImage; MatchConfidence = matchConfidence; IsIdentical = isIdentical; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -77,8 +70,6 @@ internal LivenessWithVerifyOutputs() { } - /// The detail of face for verification. - public LivenessWithVerifyImage VerifyImage { get; } /// The target face liveness face and comparison image face verification confidence. public float MatchConfidence { get; } /// Whether the target liveness face and comparison image face match. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs similarity index 65% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs index fa30773e4bc8..dcf2014c1505 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessWithVerifyImage : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyReference : 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,12 +28,14 @@ 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(LivenessWithVerifyImage)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{format}' format."); } + writer.WritePropertyName("referenceType"u8); + writer.WriteStringValue(ReferenceType.ToString()); writer.WritePropertyName("faceRectangle"u8); writer.WriteObjectValue(FaceRectangle, options); writer.WritePropertyName("qualityForRecognition"u8); @@ -55,19 +57,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessWithVerifyImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyReference 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(LivenessWithVerifyImage)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } - internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyReference DeserializeLivenessWithVerifyReference(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -75,12 +77,18 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE { return null; } + FaceImageType referenceType = default; FaceRectangle faceRectangle = default; QualityForRecognition qualityForRecognition = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("referenceType"u8)) + { + referenceType = new FaceImageType(property.Value.GetString()); + continue; + } if (property.NameEquals("faceRectangle"u8)) { faceRectangle = FaceRectangle.DeserializeFaceRectangle(property.Value, options); @@ -97,46 +105,46 @@ internal static LivenessWithVerifyImage DeserializeLivenessWithVerifyImage(JsonE } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessWithVerifyImage(faceRectangle, qualityForRecognition, serializedAdditionalRawData); + return new LivenessWithVerifyReference(referenceType, faceRectangle, qualityForRecognition, 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(LivenessWithVerifyImage)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support writing '{options.Format}' format."); } } - LivenessWithVerifyImage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessWithVerifyImage(document.RootElement, options); + return DeserializeLivenessWithVerifyReference(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessWithVerifyImage)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyReference)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessWithVerifyImage FromResponse(Response response) + internal static LivenessWithVerifyReference FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessWithVerifyImage(document.RootElement); + return DeserializeLivenessWithVerifyReference(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs similarity index 73% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs index 2cb09a6725ef..fe5f68bc902c 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyImage.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyReference.cs @@ -11,7 +11,7 @@ namespace Azure.AI.Vision.Face { /// The detail of face for verification. - public partial class LivenessWithVerifyImage + public partial class LivenessWithVerifyReference { /// /// Keeps track of any properties unknown to the library. @@ -45,34 +45,40 @@ public partial class LivenessWithVerifyImage /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. /// The face region where the comparison image's classification was made. /// Quality of face image for recognition. /// is null. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition) { Argument.AssertNotNull(faceRectangle, nameof(faceRectangle)); + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The image type which contains the face rectangle where the liveness classification was made on. /// The face region where the comparison image's classification was made. /// Quality of face image for recognition. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifyImage(FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifyReference(FaceImageType referenceType, FaceRectangle faceRectangle, QualityForRecognition qualityForRecognition, IDictionary serializedAdditionalRawData) { + ReferenceType = referenceType; FaceRectangle = faceRectangle; QualityForRecognition = qualityForRecognition; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Initializes a new instance of for deserialization. - internal LivenessWithVerifyImage() + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyReference() { } + /// The image type which contains the face rectangle where the liveness classification was made on. + public FaceImageType ReferenceType { get; } /// The face region where the comparison image's classification was made. public FaceRectangle FaceRectangle { get; } /// Quality of face image for recognition. diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs similarity index 55% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs index 48df626d12e3..f34e22a4cdbe 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionAuditEntry.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessSessionAuditEntry : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifyResult : 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,26 +28,19 @@ 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(LivenessSessionAuditEntry)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{format}' format."); } - writer.WritePropertyName("id"u8); - writer.WriteNumberValue(Id); - writer.WritePropertyName("sessionId"u8); - writer.WriteStringValue(SessionId); - writer.WritePropertyName("requestId"u8); - writer.WriteStringValue(RequestId); - writer.WritePropertyName("clientRequestId"u8); - writer.WriteStringValue(ClientRequestId); - writer.WritePropertyName("receivedDateTime"u8); - writer.WriteStringValue(ReceivedDateTime, "O"); - writer.WritePropertyName("request"u8); - writer.WriteObjectValue(Request, options); - writer.WritePropertyName("response"u8); - writer.WriteObjectValue(Response, options); + if (Optional.IsDefined(LivenessDecision)) + { + writer.WritePropertyName("livenessDecision"u8); + writer.WriteStringValue(LivenessDecision.Value.ToString()); + } + writer.WritePropertyName("targets"u8); + writer.WriteObjectValue(Targets, options); writer.WritePropertyName("digest"u8); writer.WriteStringValue(Digest); if (Optional.IsDefined(SessionImageId)) @@ -55,6 +48,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("sessionImageId"u8); writer.WriteStringValue(SessionImageId); } + if (Optional.IsDefined(VerifyResult)) + { + writer.WritePropertyName("verifyResult"u8); + writer.WriteObjectValue(VerifyResult, options); + } if (Optional.IsDefined(VerifyImageHash)) { writer.WritePropertyName("verifyImageHash"u8); @@ -77,19 +75,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessSessionAuditEntry IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifyResult 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(LivenessSessionAuditEntry)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } - internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifyResult DeserializeLivenessWithVerifyResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -97,53 +95,28 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J { return null; } - long id = default; - string sessionId = default; - string requestId = default; - string clientRequestId = default; - DateTimeOffset receivedDateTime = default; - AuditRequestInfo request = default; - AuditLivenessResponseInfo response = default; + FaceLivenessDecision? livenessDecision = default; + LivenessDecisionTargets targets = default; string digest = default; string sessionImageId = default; + LivenessWithVerifyOutputs verifyResult = default; string verifyImageHash = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) - { - id = property.Value.GetInt64(); - continue; - } - if (property.NameEquals("sessionId"u8)) - { - sessionId = property.Value.GetString(); - continue; - } - if (property.NameEquals("requestId"u8)) - { - requestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("clientRequestId"u8)) + if (property.NameEquals("livenessDecision"u8)) { - clientRequestId = property.Value.GetString(); - continue; - } - if (property.NameEquals("receivedDateTime"u8)) - { - receivedDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("request"u8)) - { - request = AuditRequestInfo.DeserializeAuditRequestInfo(property.Value, options); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + livenessDecision = new FaceLivenessDecision(property.Value.GetString()); continue; } - if (property.NameEquals("response"u8)) + if (property.NameEquals("targets"u8)) { - response = AuditLivenessResponseInfo.DeserializeAuditLivenessResponseInfo(property.Value, options); + targets = LivenessDecisionTargets.DeserializeLivenessDecisionTargets(property.Value, options); continue; } if (property.NameEquals("digest"u8)) @@ -156,6 +129,15 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J sessionImageId = property.Value.GetString(); continue; } + if (property.NameEquals("verifyResult"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + verifyResult = LivenessWithVerifyOutputs.DeserializeLivenessWithVerifyOutputs(property.Value, options); + continue; + } if (property.NameEquals("verifyImageHash"u8)) { verifyImageHash = property.Value.GetString(); @@ -167,57 +149,53 @@ internal static LivenessSessionAuditEntry DeserializeLivenessSessionAuditEntry(J } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionAuditEntry( - id, - sessionId, - requestId, - clientRequestId, - receivedDateTime, - request, - response, + return new LivenessWithVerifyResult( + livenessDecision, + targets, digest, sessionImageId, + verifyResult, verifyImageHash, 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(LivenessSessionAuditEntry)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support writing '{options.Format}' format."); } } - LivenessSessionAuditEntry IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifyResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionAuditEntry(document.RootElement, options); + return DeserializeLivenessWithVerifyResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessSessionAuditEntry)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifyResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessSessionAuditEntry FromResponse(Response response) + internal static LivenessWithVerifyResult FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionAuditEntry(document.RootElement); + return DeserializeLivenessWithVerifyResult(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs new file mode 100644 index 000000000000..730d5cac8f3c --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifyResult.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness with verify call. + public partial class LivenessWithVerifyResult + { + /// + /// 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 . + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// or is null. + internal LivenessWithVerifyResult(LivenessDecisionTargets targets, string digest) + { + Argument.AssertNotNull(targets, nameof(targets)); + Argument.AssertNotNull(digest, nameof(digest)); + + Targets = targets; + Digest = digest; + } + + /// Initializes a new instance of . + /// The liveness classification for the target face. + /// Targets used for liveness classification. + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + /// The image ID of the session request. + /// The face verification output. Only available when the request is liveness with verify. + /// The sha256 hash of the verify-image in the request. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifyResult(FaceLivenessDecision? livenessDecision, LivenessDecisionTargets targets, string digest, string sessionImageId, LivenessWithVerifyOutputs verifyResult, string verifyImageHash, IDictionary serializedAdditionalRawData) + { + LivenessDecision = livenessDecision; + Targets = targets; + Digest = digest; + SessionImageId = sessionImageId; + VerifyResult = verifyResult; + VerifyImageHash = verifyImageHash; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifyResult() + { + } + + /// The liveness classification for the target face. + public FaceLivenessDecision? LivenessDecision { get; } + /// Targets used for liveness classification. + public LivenessDecisionTargets Targets { get; } + /// The server calculated digest for this request. If the client reported digest differs from the server calculated digest, then the message integrity between the client and service has been compromised and the result should not be trusted. For more information, see how to guides on how to leverage this value to secure your end-to-end solution. + public string Digest { get; } + /// The image ID of the session request. + public string SessionImageId { get; } + /// The face verification output. Only available when the request is liveness with verify. + public LivenessWithVerifyOutputs VerifyResult { get; } + /// The sha256 hash of the verify-image in the request. + public string VerifyImageHash { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs index d025789726cf..e8db35212e75 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.Serialization.cs @@ -36,35 +36,20 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W") { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) - { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("sessionId"u8); + writer.WriteStringValue(SessionId); } + writer.WritePropertyName("authToken"u8); + writer.WriteStringValue(AuthToken); writer.WritePropertyName("status"u8); writer.WriteStringValue(Status.ToString()); - if (Optional.IsDefined(Result)) + if (Optional.IsDefined(ModelVersion)) { - writer.WritePropertyName("result"u8); - writer.WriteObjectValue(Result, options); + writer.WritePropertyName("modelVersion"u8); + writer.WriteStringValue(ModelVersion.Value.ToString()); } + writer.WritePropertyName("results"u8); + writer.WriteObjectValue(Results, options); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -102,68 +87,42 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; - FaceSessionStatus status = default; - LivenessSessionAuditEntry result = default; + string sessionId = default; + string authToken = default; + OperationState status = default; + LivenessModel? modelVersion = default; + LivenessWithVerifySessionResults results = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("sessionId"u8)) { - id = property.Value.GetString(); + sessionId = property.Value.GetString(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("authToken"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionStartDateTime"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); + authToken = property.Value.GetString(); continue; } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) + if (property.NameEquals("status"u8)) { - deviceCorrelationId = property.Value.GetString(); + status = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("modelVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); - continue; - } - if (property.NameEquals("status"u8)) - { - status = new FaceSessionStatus(property.Value.GetString()); + modelVersion = new LivenessModel(property.Value.GetString()); continue; } - if (property.NameEquals("result"u8)) + if (property.NameEquals("results"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - result = LivenessSessionAuditEntry.DeserializeLivenessSessionAuditEntry(property.Value, options); + results = LivenessWithVerifySessionResults.DeserializeLivenessWithVerifySessionResults(property.Value, options); continue; } if (options.Format != "W") @@ -173,14 +132,11 @@ internal static LivenessWithVerifySession DeserializeLivenessWithVerifySession(J } serializedAdditionalRawData = rawDataDictionary; return new LivenessWithVerifySession( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, + sessionId, + authToken, status, - result, + modelVersion, + results, serializedAdditionalRawData); } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs index 9aaec1db8d47..5db8b918edbc 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySession.cs @@ -46,36 +46,34 @@ public partial class LivenessWithVerifySession private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - /// DateTime when this session was created. - /// Whether or not the session is expired. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - internal LivenessWithVerifySession(DateTimeOffset createdDateTime, bool sessionExpired, FaceSessionStatus status) + /// The results of the liveness with verify session. + /// or is null. + internal LivenessWithVerifySession(string authToken, OperationState status, LivenessWithVerifySessionResults results) { - CreatedDateTime = createdDateTime; - SessionExpired = sessionExpired; + Argument.AssertNotNull(authToken, nameof(authToken)); + Argument.AssertNotNull(results, nameof(results)); + + AuthToken = authToken; Status = status; + Results = results; } /// Initializes a new instance of . - /// The unique ID to reference this session. - /// DateTime when this session was created. - /// DateTime when this session was started by the client. - /// Whether or not the session is expired. - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. + /// The unique ID to reference this session. + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. /// The current status of the session. - /// The latest session audit result only populated if status == 'ResultAvailable'. + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + /// The results of the liveness with verify session. /// Keeps track of any properties unknown to the library. - internal LivenessWithVerifySession(string id, DateTimeOffset createdDateTime, DateTimeOffset? sessionStartDateTime, bool sessionExpired, string deviceCorrelationId, int? authTokenTimeToLiveInSeconds, FaceSessionStatus status, LivenessSessionAuditEntry result, IDictionary serializedAdditionalRawData) + internal LivenessWithVerifySession(string sessionId, string authToken, OperationState status, LivenessModel? modelVersion, LivenessWithVerifySessionResults results, IDictionary serializedAdditionalRawData) { - Id = id; - CreatedDateTime = createdDateTime; - SessionStartDateTime = sessionStartDateTime; - SessionExpired = sessionExpired; - DeviceCorrelationId = deviceCorrelationId; - AuthTokenTimeToLiveInSeconds = authTokenTimeToLiveInSeconds; + SessionId = sessionId; + AuthToken = authToken; Status = status; - Result = result; + ModelVersion = modelVersion; + Results = results; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -85,20 +83,14 @@ internal LivenessWithVerifySession() } /// The unique ID to reference this session. - public string Id { get; } - /// DateTime when this session was created. - public DateTimeOffset CreatedDateTime { get; } - /// DateTime when this session was started by the client. - public DateTimeOffset? SessionStartDateTime { get; } - /// Whether or not the session is expired. - public bool SessionExpired { get; } - /// Unique Guid per each end-user device. This is to provide rate limiting and anti-hammering. If 'deviceCorrelationIdSetInClient' is true in this request, this 'deviceCorrelationId' must be null. - public string DeviceCorrelationId { get; } - /// Seconds the session should last for. Range is 60 to 86400 seconds. Default value is 600. - public int? AuthTokenTimeToLiveInSeconds { get; } + public string SessionId { get; } + /// Bearer token to provide authentication for the Vision SDK running on a client application. This Bearer token has limited permissions to perform only the required action and expires after the TTL time. It is also auditable. + public string AuthToken { get; } /// The current status of the session. - public FaceSessionStatus Status { get; } - /// The latest session audit result only populated if status == 'ResultAvailable'. - public LivenessSessionAuditEntry Result { get; } + public OperationState Status { get; } + /// The model version used for liveness classification. This is an optional parameter, and if this is not specified, then the latest supported model version will be chosen. + public LivenessModel? ModelVersion { get; } + /// The results of the liveness with verify session. + public LivenessWithVerifySessionResults Results { get; } } } diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs similarity index 51% rename from sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs rename to sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs index e86fb126c760..97f9fadec5e6 100644 --- a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessSessionItem.Serialization.cs +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.Serialization.cs @@ -13,11 +13,11 @@ namespace Azure.AI.Vision.Face { - public partial class LivenessSessionItem : IUtf8JsonSerializable, IJsonModel + public partial class LivenessWithVerifySessionAttempt : 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,35 +28,25 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri /// 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(LivenessSessionItem)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{format}' format."); } - if (options.Format != "W") + writer.WritePropertyName("attemptId"u8); + writer.WriteNumberValue(AttemptId); + writer.WritePropertyName("attemptStatus"u8); + writer.WriteStringValue(AttemptStatus.ToString()); + if (Optional.IsDefined(Result)) { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); + writer.WritePropertyName("result"u8); + writer.WriteObjectValue(Result, options); } - writer.WritePropertyName("createdDateTime"u8); - writer.WriteStringValue(CreatedDateTime, "O"); - if (Optional.IsDefined(SessionStartDateTime)) + if (Optional.IsDefined(Error)) { - writer.WritePropertyName("sessionStartDateTime"u8); - writer.WriteStringValue(SessionStartDateTime.Value, "O"); - } - writer.WritePropertyName("sessionExpired"u8); - writer.WriteBooleanValue(SessionExpired); - if (Optional.IsDefined(DeviceCorrelationId)) - { - writer.WritePropertyName("deviceCorrelationId"u8); - writer.WriteStringValue(DeviceCorrelationId); - } - if (Optional.IsDefined(AuthTokenTimeToLiveInSeconds)) - { - writer.WritePropertyName("authTokenTimeToLiveInSeconds"u8); - writer.WriteNumberValue(AuthTokenTimeToLiveInSeconds.Value); + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -75,19 +65,19 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit } } - LivenessSessionItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt 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(LivenessSessionItem)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLivenessSessionItem(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } - internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement element, ModelReaderWriterOptions options = null) + internal static LivenessWithVerifySessionAttempt DeserializeLivenessWithVerifySessionAttempt(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -95,52 +85,40 @@ internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement e { return null; } - string id = default; - DateTimeOffset createdDateTime = default; - DateTimeOffset? sessionStartDateTime = default; - bool sessionExpired = default; - string deviceCorrelationId = default; - int? authTokenTimeToLiveInSeconds = default; + int attemptId = default; + OperationState attemptStatus = default; + LivenessWithVerifyResult result = default; + LivenessError error = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("id"u8)) + if (property.NameEquals("attemptId"u8)) { - id = property.Value.GetString(); + attemptId = property.Value.GetInt32(); continue; } - if (property.NameEquals("createdDateTime"u8)) + if (property.NameEquals("attemptStatus"u8)) { - createdDateTime = property.Value.GetDateTimeOffset("O"); + attemptStatus = new OperationState(property.Value.GetString()); continue; } - if (property.NameEquals("sessionStartDateTime"u8)) + if (property.NameEquals("result"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - sessionStartDateTime = property.Value.GetDateTimeOffset("O"); - continue; - } - if (property.NameEquals("sessionExpired"u8)) - { - sessionExpired = property.Value.GetBoolean(); - continue; - } - if (property.NameEquals("deviceCorrelationId"u8)) - { - deviceCorrelationId = property.Value.GetString(); + result = LivenessWithVerifyResult.DeserializeLivenessWithVerifyResult(property.Value, options); continue; } - if (property.NameEquals("authTokenTimeToLiveInSeconds"u8)) + if (property.NameEquals("error"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - authTokenTimeToLiveInSeconds = property.Value.GetInt32(); + error = LivenessError.DeserializeLivenessError(property.Value, options); continue; } if (options.Format != "W") @@ -149,53 +127,46 @@ internal static LivenessSessionItem DeserializeLivenessSessionItem(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new LivenessSessionItem( - id, - createdDateTime, - sessionStartDateTime, - sessionExpired, - deviceCorrelationId, - authTokenTimeToLiveInSeconds, - serializedAdditionalRawData); + return new LivenessWithVerifySessionAttempt(attemptId, attemptStatus, result, error, 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(LivenessSessionItem)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support writing '{options.Format}' format."); } } - LivenessSessionItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LivenessWithVerifySessionAttempt IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionItem(document.RootElement, options); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LivenessSessionItem)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LivenessWithVerifySessionAttempt)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; /// Deserializes the model from a raw response. /// The response to deserialize the model from. - internal static LivenessSessionItem FromResponse(Response response) + internal static LivenessWithVerifySessionAttempt FromResponse(Response response) { using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); - return DeserializeLivenessSessionItem(document.RootElement); + return DeserializeLivenessWithVerifySessionAttempt(document.RootElement); } /// Convert into a . diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs new file mode 100644 index 000000000000..947837cf1967 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionAttempt.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.AI.Vision.Face +{ + /// The liveness with verify session attempt. + public partial class LivenessWithVerifySessionAttempt + { + /// + /// 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 attempt ID, start from 1. + /// The status of the attempt. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + } + + /// Initializes a new instance of . + /// The attempt ID, start from 1. + /// The status of the attempt. + /// The result of the liveness with verify call, will be null if there is error. + /// The error of the liveness with verify call, will be null if there is result. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionAttempt(int attemptId, OperationState attemptStatus, LivenessWithVerifyResult result, LivenessError error, IDictionary serializedAdditionalRawData) + { + AttemptId = attemptId; + AttemptStatus = attemptStatus; + Result = result; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionAttempt() + { + } + + /// The attempt ID, start from 1. + public int AttemptId { get; } + /// The status of the attempt. + public OperationState AttemptStatus { get; } + /// The result of the liveness with verify call, will be null if there is error. + public LivenessWithVerifyResult Result { get; } + /// The error of the liveness with verify call, will be null if there is result. + public LivenessError Error { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.Serialization.cs new file mode 100644 index 000000000000..9a8dda439b7b --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.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.AI.Vision.Face +{ + public partial class LivenessWithVerifySessionResults : 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(LivenessWithVerifySessionResults)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("verifyReferences"u8); + writer.WriteStartArray(); + foreach (var item in VerifyReferences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("attempts"u8); + writer.WriteStartArray(); + foreach (var item in Attempts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + LivenessWithVerifySessionResults 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(LivenessWithVerifySessionResults)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + + internal static LivenessWithVerifySessionResults DeserializeLivenessWithVerifySessionResults(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList verifyReferences = default; + IReadOnlyList attempts = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("verifyReferences"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifyReference.DeserializeLivenessWithVerifyReference(item, options)); + } + verifyReferences = array; + continue; + } + if (property.NameEquals("attempts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LivenessWithVerifySessionAttempt.DeserializeLivenessWithVerifySessionAttempt(item, options)); + } + attempts = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new LivenessWithVerifySessionResults(verifyReferences, attempts, 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(LivenessWithVerifySessionResults)} does not support writing '{options.Format}' format."); + } + } + + LivenessWithVerifySessionResults IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionResults(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(LivenessWithVerifySessionResults)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LivenessWithVerifySessionResults FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeLivenessWithVerifySessionResults(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs new file mode 100644 index 000000000000..570a83f964c2 --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/LivenessWithVerifySessionResults.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.AI.Vision.Face +{ + /// The results of the liveness with verify session. + public partial class LivenessWithVerifySessionResults + { + /// + /// 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 references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// or is null. + internal LivenessWithVerifySessionResults(IEnumerable verifyReferences, IEnumerable attempts) + { + Argument.AssertNotNull(verifyReferences, nameof(verifyReferences)); + Argument.AssertNotNull(attempts, nameof(attempts)); + + VerifyReferences = verifyReferences.ToList(); + Attempts = attempts.ToList(); + } + + /// Initializes a new instance of . + /// The references used for face verification. + /// The attempts data of underlying liveness with verify call with the session. + /// Keeps track of any properties unknown to the library. + internal LivenessWithVerifySessionResults(IReadOnlyList verifyReferences, IReadOnlyList attempts, IDictionary serializedAdditionalRawData) + { + VerifyReferences = verifyReferences; + Attempts = attempts; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal LivenessWithVerifySessionResults() + { + } + + /// The references used for face verification. + public IReadOnlyList VerifyReferences { get; } + /// The attempts data of underlying liveness with verify call with the session. + public IReadOnlyList Attempts { get; } + } +} diff --git a/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs new file mode 100644 index 000000000000..11c8033fba6a --- /dev/null +++ b/sdk/face/Azure.AI.Vision.Face/src/Generated/OperationState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.AI.Vision.Face +{ + /// Enum describing allowed operation states. + public readonly partial struct OperationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OperationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotStartedValue = "NotStarted"; + private const string RunningValue = "Running"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// The operation has not started. + public static OperationState NotStarted { get; } = new OperationState(NotStartedValue); + /// The operation is in progress. + public static OperationState Running { get; } = new OperationState(RunningValue); + /// The operation has completed successfully. + public static OperationState Succeeded { get; } = new OperationState(SucceededValue); + /// The operation has failed. + public static OperationState Failed { get; } = new OperationState(FailedValue); + /// The operation has been canceled by the user. + public static OperationState Canceled { get; } = new OperationState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(OperationState left, OperationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OperationState left, OperationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OperationState(string value) => new OperationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OperationState other && Equals(other); + /// + public bool Equals(OperationState 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/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs index b793cf92c5e9..01e05583b87c 100644 --- a/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs +++ b/sdk/face/Azure.AI.Vision.Face/tests/Generated/Samples/Samples_FaceSessionClient.cs @@ -28,8 +28,7 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -38,6 +37,9 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession( JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -51,8 +53,7 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe using RequestContent content = RequestContent.Create(new { livenessOperationMode = "Passive", - sendResultsToClient = true, - deviceCorrelationIdSetInClient = true, + deviceCorrelationIdSetInClient = false, deviceCorrelationId = "your_device_correlation_id", authTokenTimeToLiveInSeconds = 60, }); @@ -61,6 +62,9 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("sessionId").ToString()); Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -73,12 +77,11 @@ public void Example_LivenessSession_CreateLivenessSession_CreateLivenessSession_ CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = client.CreateLivenessSession(body); + Response response = client.CreateLivenessSession(body); } [Test] @@ -91,12 +94,11 @@ public async Task Example_LivenessSession_CreateLivenessSession_CreateLivenessSe CreateLivenessSessionContent body = new CreateLivenessSessionContent(LivenessOperationMode.Passive) { - SendResultsToClient = true, - DeviceCorrelationIdSetInClient = true, + DeviceCorrelationIdSetInClient = false, DeviceCorrelationId = "your_device_correlation_id", AuthTokenTimeToLiveInSeconds = 60, }; - Response response = await client.CreateLivenessSessionAsync(body); + Response response = await client.CreateLivenessSessionAsync(body); } [Test] @@ -136,10 +138,11 @@ public void Example_LivenessSession_GetLivenessSessionResult_GetLivenessSessionR Response response = client.GetLivenessSessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -153,10 +156,11 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe Response response = await client.GetLivenessSessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -183,128 +187,76 @@ public async Task Example_LivenessSession_GetLivenessSessionResult_GetLivenessSe [Test] [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessSessions("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessSessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessSessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessSession_GetLivenessSessions_GetLivenessSessions_Convenience_Async() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = await client.GetLivenessSessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); + using RequestContent content = null; + Response response = client.CreateLivenessWithVerifySession(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); + using RequestContent content = null; + Response response = await client.CreateLivenessWithVerifySessionAsync(content, null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); + Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience() + public void Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = client.GetLivenessSessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); + CreateLivenessWithVerifySessionContent body = null; + Response response = client.CreateLivenessWithVerifySession(body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessSessionAuditEntries_GetLivenessSessionAuditEntries_Convenience_Async() + public async Task Example_LivenessWithVerifySession_CreateLivenessWithVerifySession_CreateLivenessWithVerifySession_Convenience_Async() { Uri endpoint = new Uri(""); AzureKeyCredential credential = new AzureKeyCredential(""); FaceSessionClient client = new FaceSessionClient(endpoint, credential); - Response> response = await client.GetLivenessSessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); + CreateLivenessWithVerifySessionContent body = null; + Response response = await client.CreateLivenessWithVerifySessionAsync(body); } [Test] @@ -344,10 +296,17 @@ public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessionResult Response response = client.GetLivenessWithVerifySessionResult("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -361,10 +320,17 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("createdDateTime").ToString()); - Console.WriteLine(result.GetProperty("sessionExpired").ToString()); + Console.WriteLine(result.GetProperty("sessionId").ToString()); + Console.WriteLine(result.GetProperty("authToken").ToString()); Console.WriteLine(result.GetProperty("status").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("referenceType").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("top").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("left").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("width").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("faceRectangle").GetProperty("height").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("verifyReferences")[0].GetProperty("qualityForRecognition").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptId").ToString()); + Console.WriteLine(result.GetProperty("results").GetProperty("attempts")[0].GetProperty("attemptStatus").ToString()); } [Test] @@ -389,132 +355,6 @@ public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySession Response response = await client.GetLivenessWithVerifySessionResultAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); } - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessWithVerifySessions("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessWithVerifySessionsAsync("00000000-0000-0000-0000-000000000000", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("createdDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("sessionExpired").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessions(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_LivenessWithVerifySession_GetLivenessWithVerifySessions_GetLivenessWithVerifySessions_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionsAsync(); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e", "0", 20, null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result[0].GetProperty("id").ToString()); - Console.WriteLine(result[0].GetProperty("sessionId").ToString()); - Console.WriteLine(result[0].GetProperty("requestId").ToString()); - Console.WriteLine(result[0].GetProperty("clientRequestId").ToString()); - Console.WriteLine(result[0].GetProperty("receivedDateTime").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("url").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("method").ToString()); - Console.WriteLine(result[0].GetProperty("request").GetProperty("contentType").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("body").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("statusCode").ToString()); - Console.WriteLine(result[0].GetProperty("response").GetProperty("latencyInMilliseconds").ToString()); - Console.WriteLine(result[0].GetProperty("digest").ToString()); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public void Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = client.GetLivenessWithVerifySessionAuditEntries("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - - [Test] - [Ignore("Only validating compilation of examples")] - public async Task Example_FaceSessionClient_GetLivenessWithVerifySessionAuditEntries_GetLivenessWithVerifySessionAuditEntries_Convenience_Async() - { - Uri endpoint = new Uri(""); - AzureKeyCredential credential = new AzureKeyCredential(""); - FaceSessionClient client = new FaceSessionClient(endpoint, credential); - - Response> response = await client.GetLivenessWithVerifySessionAuditEntriesAsync("b12e033e-bda7-4b83-a211-e721c661f30e"); - } - [Test] [Ignore("Only validating compilation of examples")] public void Example_FaceSessionClient_DetectFromSessionImage_DetectFromSessionImageId() diff --git a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml index aa57e9f30142..10217c06987f 100644 --- a/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml +++ b/sdk/face/Azure.AI.Vision.Face/tsp-location.yaml @@ -1,5 +1,4 @@ directory: specification/ai/Face -commit: 4037b28c1014648f4cfa6f8c965e45f2476652e2 -repo: Azure/azure-rest-api-specs -additionalDirectories: [] - +commit: a3dcf1c9eb0324a1e4e9a12ec4655f54ba1f44f5 +repo: test-repo-billy/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..55ba015c15a2 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -52,6 +52,7 @@ trigger: - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - sdk/containerservice/Azure.ResourceManager.ContainerService + - sdk/contoso/Azure.ResourceManager.Contoso - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/costmanagement/Azure.ResourceManager.CostManagement @@ -79,7 +80,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 +108,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 @@ -258,6 +259,7 @@ pr: - sdk/containerorchestratorruntime/Azure.ResourceManager.ContainerOrchestratorRuntime - sdk/containerregistry/Azure.ResourceManager.ContainerRegistry - sdk/containerservice/Azure.ResourceManager.ContainerService + - sdk/contoso/Azure.ResourceManager.Contoso - sdk/cosmosdb/Azure.ResourceManager.CosmosDB - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/costmanagement/Azure.ResourceManager.CostManagement @@ -285,7 +287,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 +315,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 diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.net8.0.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.net8.0.cs index 108720ecaccc..ae6d4ba9b00b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.net8.0.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.net8.0.cs @@ -297,16 +297,17 @@ protected DistributedAvailabilityGroupCollection() { } public partial class DistributedAvailabilityGroupData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DistributedAvailabilityGroupData() { } + public System.Collections.Generic.IList Databases { get { throw null; } } public System.Guid? DistributedAvailabilityGroupId { get { throw null; } } - public string LastHardenedLsn { get { throw null; } } - public string LinkState { get { throw null; } } - public string PrimaryAvailabilityGroupName { get { throw null; } set { } } - public Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode? ReplicationMode { get { throw null; } set { } } - public string SecondaryAvailabilityGroupName { get { throw null; } set { } } - public string SourceEndpoint { get { throw null; } set { } } - public System.Guid? SourceReplicaId { get { throw null; } } - public string TargetDatabase { get { throw null; } set { } } - public System.Guid? TargetReplicaId { get { throw null; } } + public string DistributedAvailabilityGroupName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.FailoverModeType? FailoverMode { get { throw null; } set { } } + public string InstanceAvailabilityGroupName { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.LinkRole? InstanceLinkRole { get { throw null; } set { } } + public string PartnerAvailabilityGroupName { get { throw null; } set { } } + public string PartnerEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.LinkRole? PartnerLinkRole { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ReplicationModeType? ReplicationMode { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.SeedingModeType? SeedingMode { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -323,8 +324,12 @@ protected DistributedAvailabilityGroupResource() { } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Failover(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> FailoverAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation SetRole(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetRoleAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1871,15 +1876,22 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator Administrators { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? AuthenticationMetadata { get { throw null; } set { } } public string Collation { get { throw null; } set { } } + public System.DateTimeOffset? CreateOn { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? CurrentBackupStorageRedundancy { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? DatabaseFormat { get { throw null; } set { } } public string DnsZone { get { throw null; } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public string DnsZonePartner { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? ExternalGovernanceStatus { get { throw null; } } public string FullyQualifiedDomainName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? HybridSecondaryUsage { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.Core.ResourceIdentifier InstancePoolId { get { throw null; } set { } } + public bool? IsGeneralPurposeV2 { get { throw null; } set { } } public bool? IsPublicDataEndpointEnabled { get { throw null; } set { } } public bool? IsZoneRedundant { get { throw null; } set { } } public System.Uri KeyId { get { throw null; } set { } } @@ -1888,9 +1900,10 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier ManagedDnsZonePartner { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? ManagedInstanceCreateMode { get { throw null; } set { } } public string MinimalTlsVersion { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.FreemiumType? PricingModel { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PrimaryUserAssignedIdentityId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? ProxyOverride { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get { throw null; } set { } } public System.DateTimeOffset? RestorePointInTime { get { throw null; } set { } } @@ -1898,10 +1911,13 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceManagedInstanceId { get { throw null; } set { } } public string State { get { throw null; } } + public int? StorageIOps { get { throw null; } set { } } public int? StorageSizeInGB { get { throw null; } set { } } + public int? StorageThroughputMBps { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public string TimezoneId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } + public string VirtualClusterId { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -2362,14 +2378,16 @@ protected ManagedInstanceResource() { } public virtual Azure.Pageable GetTopQueries(int? numberOfQueries = default(int?), string databases = null, string startTime = null, string endTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? interval = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), Azure.ResourceManager.Sql.Models.AggregationFunctionType? aggregationFunction = default(Azure.ResourceManager.Sql.Models.AggregationFunctionType?), Azure.ResourceManager.Sql.Models.SqlMetricType? observationMetric = default(Azure.ResourceManager.Sql.Models.SqlMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetTopQueriesAsync(Azure.ResourceManager.Sql.Models.ManagedInstanceResourceGetTopQueriesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetTopQueriesAsync(int? numberOfQueries = default(int?), string databases = null, string startTime = null, string endTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? interval = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), Azure.ResourceManager.Sql.Models.AggregationFunctionType? aggregationFunction = default(Azure.ResourceManager.Sql.Models.AggregationFunctionType?), Azure.ResourceManager.Sql.Models.SqlMetricType? observationMetric = default(Azure.ResourceManager.Sql.Models.SqlMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation RefreshStatus(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RefreshStatusAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Start(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task StartAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Stop(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task StopAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Start(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StartAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Stop(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StopAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -7099,6 +7117,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.AutomaticTuningServerOptions AutomaticTuningServerOptions(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeDesired? desiredState = default(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeDesired?), Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeActual? actualState = default(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeActual?), int? reasonCode = default(int?), Azure.ResourceManager.Sql.Models.AutomaticTuningServerReason? reasonDesc = default(Azure.ResourceManager.Sql.Models.AutomaticTuningServerReason?)) { throw null; } public static Azure.ResourceManager.Sql.Models.AutoPauseDelayTimeRange AutoPauseDelayTimeRange(int? minValue = default(int?), int? maxValue = default(int?), int? stepSize = default(int?), int? @default = default(int?), Azure.ResourceManager.Sql.Models.PauseDelayTimeUnit? unit = default(Azure.ResourceManager.Sql.Models.PauseDelayTimeUnit?), int? doNotPauseValue = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.BackupShortTermRetentionPolicyData BackupShortTermRetentionPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, int? retentionDays = default(int?), Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours? diffBackupIntervalInHours = default(Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours?)) { throw null; } + public static Azure.ResourceManager.Sql.Models.CertificateInfo CertificateInfo(string certificateName = null, System.DateTimeOffset? expiryOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.DatabaseAdvancedThreatProtectionData DatabaseAdvancedThreatProtectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState? state = default(Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.DatabaseColumnData DatabaseColumnData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.SqlColumnDataType? columnType = default(Azure.ResourceManager.Sql.Models.SqlColumnDataType?), Azure.ResourceManager.Sql.Models.TableTemporalType? temporalType = default(Azure.ResourceManager.Sql.Models.TableTemporalType?), bool? isMemoryOptimized = default(bool?), bool? isComputed = default(bool?)) { throw null; } public static Azure.ResourceManager.Sql.Models.DatabaseExportDefinition DatabaseExportDefinition(Azure.ResourceManager.Sql.Models.StorageKeyType storageKeyType = default(Azure.ResourceManager.Sql.Models.StorageKeyType), string storageKey = null, System.Uri storageUri = null, string administratorLogin = null, string administratorLoginPassword = null, string authenticationType = null, Azure.ResourceManager.Sql.Models.NetworkIsolationSettings networkIsolation = null) { throw null; } @@ -7116,7 +7135,8 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.DataMaskingRule DataMaskingRule(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string kind = null, string aliasName = null, Azure.ResourceManager.Sql.Models.DataMaskingRuleState? ruleState = default(Azure.ResourceManager.Sql.Models.DataMaskingRuleState?), string schemaName = null, string tableName = null, string columnName = null, Azure.ResourceManager.Sql.Models.DataMaskingFunction? maskingFunction = default(Azure.ResourceManager.Sql.Models.DataMaskingFunction?), string numberFrom = null, string numberTo = null, string prefixSize = null, string suffixSize = null, string replacementString = null) { throw null; } public static Azure.ResourceManager.Sql.DataWarehouseUserActivityData DataWarehouseUserActivityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, int? activeQueriesCount = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.DeletedServerData DeletedServerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string version = null, System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier originalId = null, string fullyQualifiedDomainName = null) { throw null; } - public static Azure.ResourceManager.Sql.DistributedAvailabilityGroupData DistributedAvailabilityGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string targetDatabase = null, string sourceEndpoint = null, string primaryAvailabilityGroupName = null, string secondaryAvailabilityGroupName = null, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode? replicationMode = default(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode?), System.Guid? distributedAvailabilityGroupId = default(System.Guid?), System.Guid? sourceReplicaId = default(System.Guid?), System.Guid? targetReplicaId = default(System.Guid?), string linkState = null, string lastHardenedLsn = null) { throw null; } + public static Azure.ResourceManager.Sql.DistributedAvailabilityGroupData DistributedAvailabilityGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string distributedAvailabilityGroupName = null, System.Guid? distributedAvailabilityGroupId = default(System.Guid?), Azure.ResourceManager.Sql.Models.ReplicationModeType? replicationMode = default(Azure.ResourceManager.Sql.Models.ReplicationModeType?), Azure.ResourceManager.Sql.Models.LinkRole? partnerLinkRole = default(Azure.ResourceManager.Sql.Models.LinkRole?), string partnerAvailabilityGroupName = null, string partnerEndpoint = null, Azure.ResourceManager.Sql.Models.LinkRole? instanceLinkRole = default(Azure.ResourceManager.Sql.Models.LinkRole?), string instanceAvailabilityGroupName = null, Azure.ResourceManager.Sql.Models.FailoverModeType? failoverMode = default(Azure.ResourceManager.Sql.Models.FailoverModeType?), Azure.ResourceManager.Sql.Models.SeedingModeType? seedingMode = default(Azure.ResourceManager.Sql.Models.SeedingModeType?), System.Collections.Generic.IEnumerable databases = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase DistributedAvailabilityGroupDatabase(string databaseName = null, System.Guid? instanceReplicaId = default(System.Guid?), System.Guid? partnerReplicaId = default(System.Guid?), string replicaState = null, string seedingProgress = null, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth? synchronizationHealth = default(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth?), Azure.ResourceManager.Sql.Models.ReplicaConnectedState? connectedState = default(Azure.ResourceManager.Sql.Models.ReplicaConnectedState?), string lastReceivedLsn = null, System.DateTimeOffset? lastReceivedOn = default(System.DateTimeOffset?), string lastSentLsn = null, System.DateTimeOffset? lastSentOn = default(System.DateTimeOffset?), string lastCommitLsn = null, System.DateTimeOffset? lastCommitOn = default(System.DateTimeOffset?), string lastHardenedLsn = null, System.DateTimeOffset? lastHardenedOn = default(System.DateTimeOffset?), string lastBackupLsn = null, System.DateTimeOffset? lastBackupOn = default(System.DateTimeOffset?), string mostRecentLinkError = null, Azure.ResourceManager.Sql.Models.CertificateInfo partnerAuthCertValidity = null, int? instanceSendReplicationLagSeconds = default(int?), int? instanceRedoReplicationLagSeconds = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.Models.EditionCapability EditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedServiceLevelObjectives = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.ReadScaleCapability readScale = null, System.Collections.Generic.IEnumerable supportedStorageCapabilities = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ElasticPoolActivity ElasticPoolActivity(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), int? errorCode = default(int?), string errorMessage = null, int? errorSeverity = default(int?), string operation = null, System.Guid? operationId = default(System.Guid?), int? percentComplete = default(int?), int? requestedDatabaseDtuMax = default(int?), int? requestedDatabaseDtuMin = default(int?), int? requestedDtu = default(int?), string requestedElasticPoolName = null, long? requestedStorageLimitInGB = default(long?), string elasticPoolName = null, string serverName = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), string state = null, int? requestedStorageLimitInMB = default(int?), int? requestedDatabaseDtuGuarantee = default(int?), int? requestedDatabaseDtuCap = default(int?), int? requestedDtuGuarantee = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.ElasticPoolData ElasticPoolData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, string kind = null, Azure.ResourceManager.Sql.Models.ElasticPoolState? state = default(Azure.ResourceManager.Sql.Models.ElasticPoolState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), long? maxSizeBytes = default(long?), double? minCapacity = default(double?), Azure.ResourceManager.Sql.Models.ElasticPoolPerDatabaseSettings perDatabaseSettings = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.ElasticPoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ElasticPoolLicenseType?), Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, int? highAvailabilityReplicaCount = default(int?), Azure.ResourceManager.Sql.Models.SqlAlwaysEncryptedEnclaveType? preferredEnclaveType = default(Azure.ResourceManager.Sql.Models.SqlAlwaysEncryptedEnclaveType?), Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType? availabilityZone = default(Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType?)) { throw null; } @@ -7167,7 +7187,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.ManagedInstanceAdministratorData ManagedInstanceAdministratorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType? administratorType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType?), string login = null, System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceAdvancedThreatProtectionData ManagedInstanceAdvancedThreatProtectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState? state = default(Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceAzureADOnlyAuthenticationData ManagedInstanceAzureADOnlyAuthenticationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? isAzureADOnlyAuthenticationEnabled = default(bool?)) { throw null; } - public static Azure.ResourceManager.Sql.ManagedInstanceData ManagedInstanceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null) { throw null; } + public static Azure.ResourceManager.Sql.ManagedInstanceData ManagedInstanceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = default(bool?), string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? hybridSecondaryUsage = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected?), int? vCores = default(int?), int? storageSizeInGB = default(int?), int? storageIOps = default(int?), int? storageThroughputMBps = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? externalGovernanceStatus = default(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus?), Azure.ResourceManager.Sql.Models.FreemiumType? pricingModel = default(Azure.ResourceManager.Sql.Models.FreemiumType?), System.DateTimeOffset? createOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? authenticationMetadata = default(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode?), Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? databaseFormat = default(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceDtcData ManagedInstanceDtcData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? dtcEnabled = default(bool?), Azure.ResourceManager.Sql.Models.ManagedInstanceDtcSecuritySettings securitySettings = null, System.Collections.Generic.IEnumerable externalDnsSuffixSearchList = null, string dtcHostNameDnsSuffix = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?)) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceEditionCapability ManagedInstanceEditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedFamilies = null, System.Collections.Generic.IEnumerable supportedStorageCapabilities = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceEncryptionProtectorData ManagedInstanceEncryptionProtectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string kind = null, string serverKeyName = null, Azure.ResourceManager.Sql.Models.SqlServerKeyType? serverKeyType = default(Azure.ResourceManager.Sql.Models.SqlServerKeyType?), System.Uri uri = null, string thumbprint = null, bool? isAutoRotationEnabled = default(bool?)) { throw null; } @@ -7181,7 +7201,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.ManagedInstanceOperationData ManagedInstanceOperationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string managedInstanceName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = default(int?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagementOperationState? state = default(Azure.ResourceManager.Sql.Models.ManagementOperationState?), int? errorCode = default(int?), string errorDescription = null, int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTimeOffset? estimatedCompleteOn = default(System.DateTimeOffset?), string description = null, bool? isCancellable = default(bool?), Azure.ResourceManager.Sql.Models.ManagedInstanceOperationParametersPair operationParameters = null, Azure.ResourceManager.Sql.Models.ManagedInstanceOperationSteps operationSteps = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceOperationParametersPair ManagedInstanceOperationParametersPair(Azure.ResourceManager.Sql.Models.UpsertManagedServerOperationParameters currentParameters = null, Azure.ResourceManager.Sql.Models.UpsertManagedServerOperationParameters requestedParameters = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceOperationSteps ManagedInstanceOperationSteps(string totalSteps = null, int? currentStep = default(int?), System.Collections.Generic.IEnumerable stepsList = null) { throw null; } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePatch ManagedInstancePatch(Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.ManagedInstancePatch ManagedInstancePatch(Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = default(bool?), string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? hybridSecondaryUsage = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected?), int? vCores = default(int?), int? storageSizeInGB = default(int?), int? storageIOps = default(int?), int? storageThroughputMBps = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? externalGovernanceStatus = default(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus?), Azure.ResourceManager.Sql.Models.FreemiumType? pricingModel = default(Azure.ResourceManager.Sql.Models.FreemiumType?), System.DateTimeOffset? createOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? authenticationMetadata = default(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode?), Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? databaseFormat = default(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat?)) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstancePecProperty ManagedInstancePecProperty(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstancePrivateEndpointConnectionData ManagedInstancePrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateLinkServiceConnectionStateProperty connectionState = null, string provisioningState = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstancePrivateEndpointConnectionProperties ManagedInstancePrivateEndpointConnectionProperties(Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = null, string provisioningState = null) { throw null; } @@ -7209,9 +7229,10 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.PrivateEndpointConnectionRequestStatus PrivateEndpointConnectionRequestStatus(Azure.Core.ResourceIdentifier privateLinkServiceId = null, string privateEndpointConnectionName = null, string status = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ProxyResourceWithWritableName ProxyResourceWithWritableName(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryMetricInterval QueryMetricInterval(string intervalStartTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? intervalType = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), long? executionCount = default(long?), System.Collections.Generic.IEnumerable metrics = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated QueryMetricIntervalAutoGenerated(string intervalStartTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? intervalType = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), long? executionCount = default(long?), System.Collections.Generic.IEnumerable metrics = null) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryMetricProperties QueryMetricProperties(string name = null, string displayName = null, Azure.ResourceManager.Sql.Models.QueryMetricUnitType? unit = default(Azure.ResourceManager.Sql.Models.QueryMetricUnitType?), double? value = default(double?), double? min = default(double?), double? max = default(double?), double? avg = default(double?), double? sum = default(double?), double? stdev = default(double?)) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryStatistics QueryStatistics(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } - public static Azure.ResourceManager.Sql.Models.QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ReadScaleCapability ReadScaleCapability(int? maxNumberOfReplicas = default(int?), Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.RecommendedActionData RecommendedActionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string kind = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string recommendationReason = null, System.DateTimeOffset? validSince = default(System.DateTimeOffset?), System.DateTimeOffset? lastRefresh = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.RecommendedActionStateInfo state = null, bool? isExecutableAction = default(bool?), bool? isRevertableAction = default(bool?), bool? isArchivedAction = default(bool?), System.DateTimeOffset? executeActionStartOn = default(System.DateTimeOffset?), System.TimeSpan? executeActionDuration = default(System.TimeSpan?), System.DateTimeOffset? revertActionStartOn = default(System.DateTimeOffset?), System.TimeSpan? revertActionDuration = default(System.TimeSpan?), Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy? executeActionInitiatedBy = default(Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy?), System.DateTimeOffset? executeActionInitiatedOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy? revertActionInitiatedBy = default(Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy?), System.DateTimeOffset? revertActionInitiatedOn = default(System.DateTimeOffset?), int? score = default(int?), Azure.ResourceManager.Sql.Models.RecommendedActionImplementationInfo implementationDetails = null, Azure.ResourceManager.Sql.Models.RecommendedActionErrorInfo errorDetails = null, System.Collections.Generic.IEnumerable estimatedImpact = null, System.Collections.Generic.IEnumerable observedImpact = null, System.Collections.Generic.IEnumerable timeSeries = null, System.Collections.Generic.IEnumerable linkedObjects = null, System.Collections.Generic.IReadOnlyDictionary details = null) { throw null; } public static Azure.ResourceManager.Sql.Models.RecommendedActionErrorInfo RecommendedActionErrorInfo(string errorCode = null, Azure.ResourceManager.Sql.Models.ActionRetryableState? isRetryable = default(Azure.ResourceManager.Sql.Models.ActionRetryableState?)) { throw null; } @@ -7223,6 +7244,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.RecoverableDatabaseData RecoverableDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string edition = null, string serviceLevelObjective = null, string elasticPoolName = null, System.DateTimeOffset? lastAvailableBackupOn = default(System.DateTimeOffset?), System.Collections.Generic.IDictionary keys = null) { throw null; } public static Azure.ResourceManager.Sql.RecoverableManagedDatabaseData RecoverableManagedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string lastAvailableBackupDate = null) { throw null; } public static Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResult RefreshExternalGovernanceStatusOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string serverName = null, string status = null, string errorMessage = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI RefreshExternalGovernanceStatusOperationResultMI(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string managedInstanceName = null, string status = null, string errorMessage = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ResourceWithWritableName ResourceWithWritableName(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } public static Azure.ResourceManager.Sql.RestorableDroppedDatabaseData RestorableDroppedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, string databaseName = null, long? maxSizeBytes = default(long?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? backupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), System.Collections.Generic.IDictionary keys = null) { throw null; } public static Azure.ResourceManager.Sql.RestorableDroppedManagedDatabaseData RestorableDroppedManagedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string databaseName = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?)) { throw null; } @@ -7343,6 +7365,25 @@ public static partial class ArmSqlModelFactory public static bool operator !=(Azure.ResourceManager.Sql.Models.AuthenticationName left, Azure.ResourceManager.Sql.Models.AuthenticationName right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthMetadataLookupMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthMetadataLookupMode(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode AzureAD { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode Paired { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode Windows { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode left, Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode left, Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode right) { throw null; } + public override string ToString() { throw null; } + } public enum AutoExecuteStatus { Default = 0, @@ -7481,6 +7522,18 @@ public enum BlobAuditingPolicyState public static bool operator !=(Azure.ResourceManager.Sql.Models.CatalogCollationType left, Azure.ResourceManager.Sql.Models.CatalogCollationType right) { throw null; } public override string ToString() { throw null; } } + public partial class CertificateInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CertificateInfo() { } + public string CertificateName { get { throw null; } } + public System.DateTimeOffset? ExpiryOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.CertificateInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.CertificateInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ChangeLongTermRetentionBackupAccessTierParameters : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ChangeLongTermRetentionBackupAccessTierParameters(string backupStorageAccessTier, string operationMode) { } @@ -7839,23 +7892,59 @@ public enum DataMaskingState public static bool operator !=(Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours left, Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours right) { throw null; } public override string ToString() { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct DistributedAvailabilityGroupReplicationMode : System.IEquatable + public partial class DistributedAvailabilityGroupDatabase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public DistributedAvailabilityGroupReplicationMode(string value) { throw null; } - public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode Async { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode Sync { get { throw null; } } - public bool Equals(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode left, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode right) { throw null; } - public static implicit operator Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode left, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode right) { throw null; } - public override string ToString() { throw null; } + public DistributedAvailabilityGroupDatabase() { } + public Azure.ResourceManager.Sql.Models.ReplicaConnectedState? ConnectedState { get { throw null; } } + public string DatabaseName { get { throw null; } set { } } + public int? InstanceRedoReplicationLagSeconds { get { throw null; } } + public System.Guid? InstanceReplicaId { get { throw null; } } + public int? InstanceSendReplicationLagSeconds { get { throw null; } } + public string LastBackupLsn { get { throw null; } } + public System.DateTimeOffset? LastBackupOn { get { throw null; } } + public string LastCommitLsn { get { throw null; } } + public System.DateTimeOffset? LastCommitOn { get { throw null; } } + public string LastHardenedLsn { get { throw null; } } + public System.DateTimeOffset? LastHardenedOn { get { throw null; } } + public string LastReceivedLsn { get { throw null; } } + public System.DateTimeOffset? LastReceivedOn { get { throw null; } } + public string LastSentLsn { get { throw null; } } + public System.DateTimeOffset? LastSentOn { get { throw null; } } + public string MostRecentLinkError { get { throw null; } } + public Azure.ResourceManager.Sql.Models.CertificateInfo PartnerAuthCertValidity { get { throw null; } } + public System.Guid? PartnerReplicaId { get { throw null; } } + public string ReplicaState { get { throw null; } } + public string SeedingProgress { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth? SynchronizationHealth { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DistributedAvailabilityGroupSetRole : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DistributedAvailabilityGroupSetRole(Azure.ResourceManager.Sql.Models.InstanceRole instanceRole, Azure.ResourceManager.Sql.Models.RoleChangeType roleChangeType) { } + public Azure.ResourceManager.Sql.Models.InstanceRole InstanceRole { get { throw null; } } + public Azure.ResourceManager.Sql.Models.RoleChangeType RoleChangeType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DistributedAvailabilityGroupsFailoverContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DistributedAvailabilityGroupsFailoverContent(Azure.ResourceManager.Sql.Models.FailoverType failoverType) { } + public Azure.ResourceManager.Sql.Models.FailoverType FailoverType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DnsRefreshConfigurationPropertiesStatus : System.IEquatable @@ -8244,6 +8333,42 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FailoverModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FailoverModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FailoverModeType Manual { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FailoverModeType None { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FailoverModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FailoverModeType left, Azure.ResourceManager.Sql.Models.FailoverModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FailoverModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FailoverModeType left, Azure.ResourceManager.Sql.Models.FailoverModeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FailoverType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FailoverType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FailoverType ForcedAllowDataLoss { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FailoverType Planned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FailoverType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FailoverType left, Azure.ResourceManager.Sql.Models.FailoverType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FailoverType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FailoverType left, Azure.ResourceManager.Sql.Models.FailoverType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct FreeLimitExhaustionBehavior : System.IEquatable { private readonly object _dummy; @@ -8262,6 +8387,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FreemiumType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FreemiumType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FreemiumType Freemium { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FreemiumType Regular { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FreemiumType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FreemiumType left, Azure.ResourceManager.Sql.Models.FreemiumType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FreemiumType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FreemiumType left, Azure.ResourceManager.Sql.Models.FreemiumType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct GeoBackupPolicyName : System.IEquatable { private readonly object _dummy; @@ -8301,6 +8444,42 @@ public enum GeoBackupPolicyState public static bool operator !=(Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType left, Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridSecondaryUsage : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridSecondaryUsage(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsage Active { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsage Passive { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsage right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.HybridSecondaryUsage (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsage right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridSecondaryUsageDetected : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridSecondaryUsageDetected(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected Active { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected Passive { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected right) { throw null; } + public override string ToString() { throw null; } + } public enum ImplementationMethod { TSql = 0, @@ -8499,6 +8678,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InstanceRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InstanceRole(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.InstanceRole Primary { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.InstanceRole Secondary { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.InstanceRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.InstanceRole left, Azure.ResourceManager.Sql.Models.InstanceRole right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.InstanceRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.InstanceRole left, Azure.ResourceManager.Sql.Models.InstanceRole right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct JobAgentState : System.IEquatable { private readonly object _dummy; @@ -8754,6 +8951,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LinkRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LinkRole(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.LinkRole Primary { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.LinkRole Secondary { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.LinkRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.LinkRole left, Azure.ResourceManager.Sql.Models.LinkRole right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.LinkRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.LinkRole left, Azure.ResourceManager.Sql.Models.LinkRole right) { throw null; } + public override string ToString() { throw null; } + } public partial class LogSizeCapability : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LogSizeCapability() { } @@ -9015,6 +9230,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType left, Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ManagedInstanceDatabaseFormat : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ManagedInstanceDatabaseFormat(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat AlwaysUpToDate { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat SqlServer2022 { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat left, Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat left, Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat right) { throw null; } + public override string ToString() { throw null; } + } public partial class ManagedInstanceDtcSecuritySettings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ManagedInstanceDtcSecuritySettings() { } @@ -9208,13 +9441,20 @@ public ManagedInstancePatch() { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator Administrators { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? AuthenticationMetadata { get { throw null; } set { } } public string Collation { get { throw null; } set { } } + public System.DateTimeOffset? CreateOn { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? CurrentBackupStorageRedundancy { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? DatabaseFormat { get { throw null; } set { } } public string DnsZone { get { throw null; } } public string DnsZonePartner { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? ExternalGovernanceStatus { get { throw null; } } public string FullyQualifiedDomainName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? HybridSecondaryUsage { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.Core.ResourceIdentifier InstancePoolId { get { throw null; } set { } } + public bool? IsGeneralPurposeV2 { get { throw null; } set { } } public bool? IsPublicDataEndpointEnabled { get { throw null; } set { } } public bool? IsZoneRedundant { get { throw null; } set { } } public System.Uri KeyId { get { throw null; } set { } } @@ -9223,9 +9463,10 @@ public ManagedInstancePatch() { } public Azure.Core.ResourceIdentifier ManagedDnsZonePartner { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? ManagedInstanceCreateMode { get { throw null; } set { } } public string MinimalTlsVersion { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.FreemiumType? PricingModel { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PrimaryUserAssignedIdentityId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? ProxyOverride { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get { throw null; } set { } } public System.DateTimeOffset? RestorePointInTime { get { throw null; } set { } } @@ -9233,11 +9474,14 @@ public ManagedInstancePatch() { } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceManagedInstanceId { get { throw null; } set { } } public string State { get { throw null; } } + public int? StorageIOps { get { throw null; } set { } } public int? StorageSizeInGB { get { throw null; } set { } } + public int? StorageThroughputMBps { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string TimezoneId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } + public string VirtualClusterId { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.Models.ManagedInstancePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -9296,37 +9540,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ManagedInstancePropertiesProvisioningState : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ManagedInstancePropertiesProvisioningState(string value) { throw null; } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Accepted { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Canceled { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Created { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Creating { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Deleted { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Deleting { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Failed { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState NotSpecified { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Registering { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Running { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Succeeded { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState TimedOut { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Unknown { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Unrecognized { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Updating { get { throw null; } } - public bool Equals(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState left, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState right) { throw null; } - public static implicit operator Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState left, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState right) { throw null; } - public override string ToString() { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ManagedInstanceProxyOverride : System.IEquatable { private readonly object _dummy; @@ -9742,6 +9955,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class QueryMetricIntervalAutoGenerated : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QueryMetricIntervalAutoGenerated() { } + public long? ExecutionCount { get { throw null; } } + public string IntervalStartTime { get { throw null; } } + public Azure.ResourceManager.Sql.Models.QueryTimeGrainType? IntervalType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Metrics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class QueryMetricProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public QueryMetricProperties() { } @@ -9801,7 +10028,7 @@ public partial class QueryStatisticsProperties : System.ClientModel.Primitives.I internal QueryStatisticsProperties() { } public string DatabaseName { get { throw null; } } public string EndTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Intervals { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Intervals { get { throw null; } } public string QueryId { get { throw null; } } public string StartTime { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -10026,6 +10253,59 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class RefreshExternalGovernanceStatusOperationResultMI : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public RefreshExternalGovernanceStatusOperationResultMI() { } + public string ErrorMessage { get { throw null; } } + public string ManagedInstanceName { get { throw null; } } + public string QueuedTime { get { throw null; } } + public System.Guid? RequestId { get { throw null; } } + public string RequestType { get { throw null; } } + public string Status { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicaConnectedState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicaConnectedState(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicaConnectedState Connected { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaConnectedState Disconnected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicaConnectedState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicaConnectedState left, Azure.ResourceManager.Sql.Models.ReplicaConnectedState right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicaConnectedState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicaConnectedState left, Azure.ResourceManager.Sql.Models.ReplicaConnectedState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicaSynchronizationHealth : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicaSynchronizationHealth(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth Healthy { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth NOTHealthy { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth PartiallyHealthy { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth left, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth left, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ReplicationLinkState : System.IEquatable { @@ -10066,6 +10346,24 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicationModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicationModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicationModeType Async { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicationModeType Sync { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicationModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicationModeType left, Azure.ResourceManager.Sql.Models.ReplicationModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicationModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicationModeType left, Azure.ResourceManager.Sql.Models.ReplicationModeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ReplicaType : System.IEquatable { private readonly object _dummy; @@ -10119,6 +10417,24 @@ public enum RestorePointType Discrete = 1, } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RoleChangeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RoleChangeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.RoleChangeType Forced { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.RoleChangeType Planned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.RoleChangeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.RoleChangeType left, Azure.ResourceManager.Sql.Models.RoleChangeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.RoleChangeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.RoleChangeType left, Azure.ResourceManager.Sql.Models.RoleChangeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct SampleSchemaName : System.IEquatable { private readonly object _dummy; @@ -10209,6 +10525,24 @@ public enum SecurityEventType SqlInjectionVulnerability = 1, SqlInjectionExploit = 2, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SeedingModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SeedingModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.SeedingModeType Automatic { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.SeedingModeType Manual { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.SeedingModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.SeedingModeType left, Azure.ResourceManager.Sql.Models.SeedingModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.SeedingModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.SeedingModeType left, Azure.ResourceManager.Sql.Models.SeedingModeType right) { throw null; } + public override string ToString() { throw null; } + } public enum SensitivityLabelRank { None = 0, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs index 108720ecaccc..ae6d4ba9b00b 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/api/Azure.ResourceManager.Sql.netstandard2.0.cs @@ -297,16 +297,17 @@ protected DistributedAvailabilityGroupCollection() { } public partial class DistributedAvailabilityGroupData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DistributedAvailabilityGroupData() { } + public System.Collections.Generic.IList Databases { get { throw null; } } public System.Guid? DistributedAvailabilityGroupId { get { throw null; } } - public string LastHardenedLsn { get { throw null; } } - public string LinkState { get { throw null; } } - public string PrimaryAvailabilityGroupName { get { throw null; } set { } } - public Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode? ReplicationMode { get { throw null; } set { } } - public string SecondaryAvailabilityGroupName { get { throw null; } set { } } - public string SourceEndpoint { get { throw null; } set { } } - public System.Guid? SourceReplicaId { get { throw null; } } - public string TargetDatabase { get { throw null; } set { } } - public System.Guid? TargetReplicaId { get { throw null; } } + public string DistributedAvailabilityGroupName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.FailoverModeType? FailoverMode { get { throw null; } set { } } + public string InstanceAvailabilityGroupName { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.LinkRole? InstanceLinkRole { get { throw null; } set { } } + public string PartnerAvailabilityGroupName { get { throw null; } set { } } + public string PartnerEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.LinkRole? PartnerLinkRole { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ReplicationModeType? ReplicationMode { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.SeedingModeType? SeedingMode { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -323,8 +324,12 @@ protected DistributedAvailabilityGroupResource() { } public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName) { throw null; } public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Failover(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> FailoverAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation SetRole(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetRoleAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.DistributedAvailabilityGroupData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -1871,15 +1876,22 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator Administrators { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? AuthenticationMetadata { get { throw null; } set { } } public string Collation { get { throw null; } set { } } + public System.DateTimeOffset? CreateOn { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? CurrentBackupStorageRedundancy { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? DatabaseFormat { get { throw null; } set { } } public string DnsZone { get { throw null; } } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public string DnsZonePartner { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? ExternalGovernanceStatus { get { throw null; } } public string FullyQualifiedDomainName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? HybridSecondaryUsage { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.Core.ResourceIdentifier InstancePoolId { get { throw null; } set { } } + public bool? IsGeneralPurposeV2 { get { throw null; } set { } } public bool? IsPublicDataEndpointEnabled { get { throw null; } set { } } public bool? IsZoneRedundant { get { throw null; } set { } } public System.Uri KeyId { get { throw null; } set { } } @@ -1888,9 +1900,10 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public Azure.Core.ResourceIdentifier ManagedDnsZonePartner { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? ManagedInstanceCreateMode { get { throw null; } set { } } public string MinimalTlsVersion { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.FreemiumType? PricingModel { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PrimaryUserAssignedIdentityId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? ProxyOverride { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get { throw null; } set { } } public System.DateTimeOffset? RestorePointInTime { get { throw null; } set { } } @@ -1898,10 +1911,13 @@ public ManagedInstanceData(Azure.Core.AzureLocation location) { } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceManagedInstanceId { get { throw null; } set { } } public string State { get { throw null; } } + public int? StorageIOps { get { throw null; } set { } } public int? StorageSizeInGB { get { throw null; } set { } } + public int? StorageThroughputMBps { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public string TimezoneId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } + public string VirtualClusterId { get { throw null; } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -2362,14 +2378,16 @@ protected ManagedInstanceResource() { } public virtual Azure.Pageable GetTopQueries(int? numberOfQueries = default(int?), string databases = null, string startTime = null, string endTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? interval = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), Azure.ResourceManager.Sql.Models.AggregationFunctionType? aggregationFunction = default(Azure.ResourceManager.Sql.Models.AggregationFunctionType?), Azure.ResourceManager.Sql.Models.SqlMetricType? observationMetric = default(Azure.ResourceManager.Sql.Models.SqlMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetTopQueriesAsync(Azure.ResourceManager.Sql.Models.ManagedInstanceResourceGetTopQueriesOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetTopQueriesAsync(int? numberOfQueries = default(int?), string databases = null, string startTime = null, string endTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? interval = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), Azure.ResourceManager.Sql.Models.AggregationFunctionType? aggregationFunction = default(Azure.ResourceManager.Sql.Models.AggregationFunctionType?), Azure.ResourceManager.Sql.Models.SqlMetricType? observationMetric = default(Azure.ResourceManager.Sql.Models.SqlMetricType?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation RefreshStatus(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RefreshStatusAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Start(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task StartAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.ResourceManager.ArmOperation Stop(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task StopAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Start(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StartAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Stop(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StopAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.ManagedInstanceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -7099,6 +7117,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.AutomaticTuningServerOptions AutomaticTuningServerOptions(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeDesired? desiredState = default(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeDesired?), Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeActual? actualState = default(Azure.ResourceManager.Sql.Models.AutomaticTuningOptionModeActual?), int? reasonCode = default(int?), Azure.ResourceManager.Sql.Models.AutomaticTuningServerReason? reasonDesc = default(Azure.ResourceManager.Sql.Models.AutomaticTuningServerReason?)) { throw null; } public static Azure.ResourceManager.Sql.Models.AutoPauseDelayTimeRange AutoPauseDelayTimeRange(int? minValue = default(int?), int? maxValue = default(int?), int? stepSize = default(int?), int? @default = default(int?), Azure.ResourceManager.Sql.Models.PauseDelayTimeUnit? unit = default(Azure.ResourceManager.Sql.Models.PauseDelayTimeUnit?), int? doNotPauseValue = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.BackupShortTermRetentionPolicyData BackupShortTermRetentionPolicyData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, int? retentionDays = default(int?), Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours? diffBackupIntervalInHours = default(Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours?)) { throw null; } + public static Azure.ResourceManager.Sql.Models.CertificateInfo CertificateInfo(string certificateName = null, System.DateTimeOffset? expiryOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.DatabaseAdvancedThreatProtectionData DatabaseAdvancedThreatProtectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState? state = default(Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.DatabaseColumnData DatabaseColumnData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.SqlColumnDataType? columnType = default(Azure.ResourceManager.Sql.Models.SqlColumnDataType?), Azure.ResourceManager.Sql.Models.TableTemporalType? temporalType = default(Azure.ResourceManager.Sql.Models.TableTemporalType?), bool? isMemoryOptimized = default(bool?), bool? isComputed = default(bool?)) { throw null; } public static Azure.ResourceManager.Sql.Models.DatabaseExportDefinition DatabaseExportDefinition(Azure.ResourceManager.Sql.Models.StorageKeyType storageKeyType = default(Azure.ResourceManager.Sql.Models.StorageKeyType), string storageKey = null, System.Uri storageUri = null, string administratorLogin = null, string administratorLoginPassword = null, string authenticationType = null, Azure.ResourceManager.Sql.Models.NetworkIsolationSettings networkIsolation = null) { throw null; } @@ -7116,7 +7135,8 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.DataMaskingRule DataMaskingRule(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string kind = null, string aliasName = null, Azure.ResourceManager.Sql.Models.DataMaskingRuleState? ruleState = default(Azure.ResourceManager.Sql.Models.DataMaskingRuleState?), string schemaName = null, string tableName = null, string columnName = null, Azure.ResourceManager.Sql.Models.DataMaskingFunction? maskingFunction = default(Azure.ResourceManager.Sql.Models.DataMaskingFunction?), string numberFrom = null, string numberTo = null, string prefixSize = null, string suffixSize = null, string replacementString = null) { throw null; } public static Azure.ResourceManager.Sql.DataWarehouseUserActivityData DataWarehouseUserActivityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, int? activeQueriesCount = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.DeletedServerData DeletedServerData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string version = null, System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier originalId = null, string fullyQualifiedDomainName = null) { throw null; } - public static Azure.ResourceManager.Sql.DistributedAvailabilityGroupData DistributedAvailabilityGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string targetDatabase = null, string sourceEndpoint = null, string primaryAvailabilityGroupName = null, string secondaryAvailabilityGroupName = null, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode? replicationMode = default(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode?), System.Guid? distributedAvailabilityGroupId = default(System.Guid?), System.Guid? sourceReplicaId = default(System.Guid?), System.Guid? targetReplicaId = default(System.Guid?), string linkState = null, string lastHardenedLsn = null) { throw null; } + public static Azure.ResourceManager.Sql.DistributedAvailabilityGroupData DistributedAvailabilityGroupData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string distributedAvailabilityGroupName = null, System.Guid? distributedAvailabilityGroupId = default(System.Guid?), Azure.ResourceManager.Sql.Models.ReplicationModeType? replicationMode = default(Azure.ResourceManager.Sql.Models.ReplicationModeType?), Azure.ResourceManager.Sql.Models.LinkRole? partnerLinkRole = default(Azure.ResourceManager.Sql.Models.LinkRole?), string partnerAvailabilityGroupName = null, string partnerEndpoint = null, Azure.ResourceManager.Sql.Models.LinkRole? instanceLinkRole = default(Azure.ResourceManager.Sql.Models.LinkRole?), string instanceAvailabilityGroupName = null, Azure.ResourceManager.Sql.Models.FailoverModeType? failoverMode = default(Azure.ResourceManager.Sql.Models.FailoverModeType?), Azure.ResourceManager.Sql.Models.SeedingModeType? seedingMode = default(Azure.ResourceManager.Sql.Models.SeedingModeType?), System.Collections.Generic.IEnumerable databases = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase DistributedAvailabilityGroupDatabase(string databaseName = null, System.Guid? instanceReplicaId = default(System.Guid?), System.Guid? partnerReplicaId = default(System.Guid?), string replicaState = null, string seedingProgress = null, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth? synchronizationHealth = default(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth?), Azure.ResourceManager.Sql.Models.ReplicaConnectedState? connectedState = default(Azure.ResourceManager.Sql.Models.ReplicaConnectedState?), string lastReceivedLsn = null, System.DateTimeOffset? lastReceivedOn = default(System.DateTimeOffset?), string lastSentLsn = null, System.DateTimeOffset? lastSentOn = default(System.DateTimeOffset?), string lastCommitLsn = null, System.DateTimeOffset? lastCommitOn = default(System.DateTimeOffset?), string lastHardenedLsn = null, System.DateTimeOffset? lastHardenedOn = default(System.DateTimeOffset?), string lastBackupLsn = null, System.DateTimeOffset? lastBackupOn = default(System.DateTimeOffset?), string mostRecentLinkError = null, Azure.ResourceManager.Sql.Models.CertificateInfo partnerAuthCertValidity = null, int? instanceSendReplicationLagSeconds = default(int?), int? instanceRedoReplicationLagSeconds = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.Models.EditionCapability EditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedServiceLevelObjectives = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.ReadScaleCapability readScale = null, System.Collections.Generic.IEnumerable supportedStorageCapabilities = null, Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ElasticPoolActivity ElasticPoolActivity(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), int? errorCode = default(int?), string errorMessage = null, int? errorSeverity = default(int?), string operation = null, System.Guid? operationId = default(System.Guid?), int? percentComplete = default(int?), int? requestedDatabaseDtuMax = default(int?), int? requestedDatabaseDtuMin = default(int?), int? requestedDtu = default(int?), string requestedElasticPoolName = null, long? requestedStorageLimitInGB = default(long?), string elasticPoolName = null, string serverName = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), string state = null, int? requestedStorageLimitInMB = default(int?), int? requestedDatabaseDtuGuarantee = default(int?), int? requestedDatabaseDtuCap = default(int?), int? requestedDtuGuarantee = default(int?)) { throw null; } public static Azure.ResourceManager.Sql.ElasticPoolData ElasticPoolData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, string kind = null, Azure.ResourceManager.Sql.Models.ElasticPoolState? state = default(Azure.ResourceManager.Sql.Models.ElasticPoolState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), long? maxSizeBytes = default(long?), double? minCapacity = default(double?), Azure.ResourceManager.Sql.Models.ElasticPoolPerDatabaseSettings perDatabaseSettings = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.ElasticPoolLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ElasticPoolLicenseType?), Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, int? highAvailabilityReplicaCount = default(int?), Azure.ResourceManager.Sql.Models.SqlAlwaysEncryptedEnclaveType? preferredEnclaveType = default(Azure.ResourceManager.Sql.Models.SqlAlwaysEncryptedEnclaveType?), Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType? availabilityZone = default(Azure.ResourceManager.Sql.Models.SqlAvailabilityZoneType?)) { throw null; } @@ -7167,7 +7187,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.ManagedInstanceAdministratorData ManagedInstanceAdministratorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType? administratorType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType?), string login = null, System.Guid? sid = default(System.Guid?), System.Guid? tenantId = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceAdvancedThreatProtectionData ManagedInstanceAdvancedThreatProtectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState? state = default(Azure.ResourceManager.Sql.Models.AdvancedThreatProtectionState?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceAzureADOnlyAuthenticationData ManagedInstanceAzureADOnlyAuthenticationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? isAzureADOnlyAuthenticationEnabled = default(bool?)) { throw null; } - public static Azure.ResourceManager.Sql.ManagedInstanceData ManagedInstanceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null) { throw null; } + public static Azure.ResourceManager.Sql.ManagedInstanceData ManagedInstanceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = default(bool?), string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? hybridSecondaryUsage = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected?), int? vCores = default(int?), int? storageSizeInGB = default(int?), int? storageIOps = default(int?), int? storageThroughputMBps = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? externalGovernanceStatus = default(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus?), Azure.ResourceManager.Sql.Models.FreemiumType? pricingModel = default(Azure.ResourceManager.Sql.Models.FreemiumType?), System.DateTimeOffset? createOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? authenticationMetadata = default(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode?), Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? databaseFormat = default(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat?)) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceDtcData ManagedInstanceDtcData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, bool? dtcEnabled = default(bool?), Azure.ResourceManager.Sql.Models.ManagedInstanceDtcSecuritySettings securitySettings = null, System.Collections.Generic.IEnumerable externalDnsSuffixSearchList = null, string dtcHostNameDnsSuffix = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?)) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceEditionCapability ManagedInstanceEditionCapability(string name = null, System.Collections.Generic.IEnumerable supportedFamilies = null, System.Collections.Generic.IEnumerable supportedStorageCapabilities = null, bool? isZoneRedundant = default(bool?), Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstanceEncryptionProtectorData ManagedInstanceEncryptionProtectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string kind = null, string serverKeyName = null, Azure.ResourceManager.Sql.Models.SqlServerKeyType? serverKeyType = default(Azure.ResourceManager.Sql.Models.SqlServerKeyType?), System.Uri uri = null, string thumbprint = null, bool? isAutoRotationEnabled = default(bool?)) { throw null; } @@ -7181,7 +7201,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.ManagedInstanceOperationData ManagedInstanceOperationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string managedInstanceName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = default(int?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagementOperationState? state = default(Azure.ResourceManager.Sql.Models.ManagementOperationState?), int? errorCode = default(int?), string errorDescription = null, int? errorSeverity = default(int?), bool? isUserError = default(bool?), System.DateTimeOffset? estimatedCompleteOn = default(System.DateTimeOffset?), string description = null, bool? isCancellable = default(bool?), Azure.ResourceManager.Sql.Models.ManagedInstanceOperationParametersPair operationParameters = null, Azure.ResourceManager.Sql.Models.ManagedInstanceOperationSteps operationSteps = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceOperationParametersPair ManagedInstanceOperationParametersPair(Azure.ResourceManager.Sql.Models.UpsertManagedServerOperationParameters currentParameters = null, Azure.ResourceManager.Sql.Models.UpsertManagedServerOperationParameters requestedParameters = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstanceOperationSteps ManagedInstanceOperationSteps(string totalSteps = null, int? currentStep = default(int?), System.Collections.Generic.IEnumerable stepsList = null) { throw null; } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePatch ManagedInstancePatch(Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), int? vCores = default(int?), int? storageSizeInGB = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.ManagedInstancePatch ManagedInstancePatch(Azure.ResourceManager.Sql.Models.SqlSku sku = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? provisioningState = default(Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState?), Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? managedInstanceCreateMode = default(Azure.ResourceManager.Sql.Models.ManagedServerCreateMode?), string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = default(bool?), string administratorLogin = null, string administratorLoginPassword = null, Azure.Core.ResourceIdentifier subnetId = null, string state = null, Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType? licenseType = default(Azure.ResourceManager.Sql.Models.ManagedInstanceLicenseType?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? hybridSecondaryUsage = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage?), Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected?), int? vCores = default(int?), int? storageSizeInGB = default(int?), int? storageIOps = default(int?), int? storageThroughputMBps = default(int?), string collation = null, string dnsZone = null, Azure.Core.ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = default(bool?), Azure.Core.ResourceIdentifier sourceManagedInstanceId = null, System.DateTimeOffset? restorePointInTime = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? proxyOverride = default(Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride?), string timezoneId = null, Azure.Core.ResourceIdentifier instancePoolId = null, Azure.Core.ResourceIdentifier maintenanceConfigurationId = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? currentBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), bool? isZoneRedundant = default(bool?), Azure.Core.ResourceIdentifier primaryUserAssignedIdentityId = null, System.Uri keyId = null, Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator administrators = null, Azure.ResourceManager.Sql.Models.SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? externalGovernanceStatus = default(Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus?), Azure.ResourceManager.Sql.Models.FreemiumType? pricingModel = default(Azure.ResourceManager.Sql.Models.FreemiumType?), System.DateTimeOffset? createOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? authenticationMetadata = default(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode?), Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? databaseFormat = default(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat?)) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstancePecProperty ManagedInstancePecProperty(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.Sql.ManagedInstancePrivateEndpointConnectionData ManagedInstancePrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateLinkServiceConnectionStateProperty connectionState = null, string provisioningState = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ManagedInstancePrivateEndpointConnectionProperties ManagedInstancePrivateEndpointConnectionProperties(Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Sql.Models.ManagedInstancePrivateLinkServiceConnectionStateProperty privateLinkServiceConnectionState = null, string provisioningState = null) { throw null; } @@ -7209,9 +7229,10 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.Models.PrivateEndpointConnectionRequestStatus PrivateEndpointConnectionRequestStatus(Azure.Core.ResourceIdentifier privateLinkServiceId = null, string privateEndpointConnectionName = null, string status = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ProxyResourceWithWritableName ProxyResourceWithWritableName(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryMetricInterval QueryMetricInterval(string intervalStartTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? intervalType = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), long? executionCount = default(long?), System.Collections.Generic.IEnumerable metrics = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated QueryMetricIntervalAutoGenerated(string intervalStartTime = null, Azure.ResourceManager.Sql.Models.QueryTimeGrainType? intervalType = default(Azure.ResourceManager.Sql.Models.QueryTimeGrainType?), long? executionCount = default(long?), System.Collections.Generic.IEnumerable metrics = null) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryMetricProperties QueryMetricProperties(string name = null, string displayName = null, Azure.ResourceManager.Sql.Models.QueryMetricUnitType? unit = default(Azure.ResourceManager.Sql.Models.QueryMetricUnitType?), double? value = default(double?), double? min = default(double?), double? max = default(double?), double? avg = default(double?), double? sum = default(double?), double? stdev = default(double?)) { throw null; } public static Azure.ResourceManager.Sql.Models.QueryStatistics QueryStatistics(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } - public static Azure.ResourceManager.Sql.Models.QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, System.Collections.Generic.IEnumerable intervals = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ReadScaleCapability ReadScaleCapability(int? maxNumberOfReplicas = default(int?), Azure.ResourceManager.Sql.Models.SqlCapabilityStatus? status = default(Azure.ResourceManager.Sql.Models.SqlCapabilityStatus?), string reason = null) { throw null; } public static Azure.ResourceManager.Sql.RecommendedActionData RecommendedActionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string kind = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string recommendationReason = null, System.DateTimeOffset? validSince = default(System.DateTimeOffset?), System.DateTimeOffset? lastRefresh = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.RecommendedActionStateInfo state = null, bool? isExecutableAction = default(bool?), bool? isRevertableAction = default(bool?), bool? isArchivedAction = default(bool?), System.DateTimeOffset? executeActionStartOn = default(System.DateTimeOffset?), System.TimeSpan? executeActionDuration = default(System.TimeSpan?), System.DateTimeOffset? revertActionStartOn = default(System.DateTimeOffset?), System.TimeSpan? revertActionDuration = default(System.TimeSpan?), Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy? executeActionInitiatedBy = default(Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy?), System.DateTimeOffset? executeActionInitiatedOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy? revertActionInitiatedBy = default(Azure.ResourceManager.Sql.Models.RecommendedActionInitiatedBy?), System.DateTimeOffset? revertActionInitiatedOn = default(System.DateTimeOffset?), int? score = default(int?), Azure.ResourceManager.Sql.Models.RecommendedActionImplementationInfo implementationDetails = null, Azure.ResourceManager.Sql.Models.RecommendedActionErrorInfo errorDetails = null, System.Collections.Generic.IEnumerable estimatedImpact = null, System.Collections.Generic.IEnumerable observedImpact = null, System.Collections.Generic.IEnumerable timeSeries = null, System.Collections.Generic.IEnumerable linkedObjects = null, System.Collections.Generic.IReadOnlyDictionary details = null) { throw null; } public static Azure.ResourceManager.Sql.Models.RecommendedActionErrorInfo RecommendedActionErrorInfo(string errorCode = null, Azure.ResourceManager.Sql.Models.ActionRetryableState? isRetryable = default(Azure.ResourceManager.Sql.Models.ActionRetryableState?)) { throw null; } @@ -7223,6 +7244,7 @@ public static partial class ArmSqlModelFactory public static Azure.ResourceManager.Sql.RecoverableDatabaseData RecoverableDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string edition = null, string serviceLevelObjective = null, string elasticPoolName = null, System.DateTimeOffset? lastAvailableBackupOn = default(System.DateTimeOffset?), System.Collections.Generic.IDictionary keys = null) { throw null; } public static Azure.ResourceManager.Sql.RecoverableManagedDatabaseData RecoverableManagedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string lastAvailableBackupDate = null) { throw null; } public static Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResult RefreshExternalGovernanceStatusOperationResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string serverName = null, string status = null, string errorMessage = null) { throw null; } + public static Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI RefreshExternalGovernanceStatusOperationResultMI(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Guid? requestId = default(System.Guid?), string requestType = null, string queuedTime = null, string managedInstanceName = null, string status = null, string errorMessage = null) { throw null; } public static Azure.ResourceManager.Sql.Models.ResourceWithWritableName ResourceWithWritableName(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?)) { throw null; } public static Azure.ResourceManager.Sql.RestorableDroppedDatabaseData RestorableDroppedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Sql.Models.SqlSku sku = null, string databaseName = null, long? maxSizeBytes = default(long?), System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?), Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? backupStorageRedundancy = default(Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy?), System.Collections.Generic.IDictionary keys = null) { throw null; } public static Azure.ResourceManager.Sql.RestorableDroppedManagedDatabaseData RestorableDroppedManagedDatabaseData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string databaseName = null, System.DateTimeOffset? createdOn = default(System.DateTimeOffset?), System.DateTimeOffset? deletedOn = default(System.DateTimeOffset?), System.DateTimeOffset? earliestRestoreOn = default(System.DateTimeOffset?)) { throw null; } @@ -7343,6 +7365,25 @@ public static partial class ArmSqlModelFactory public static bool operator !=(Azure.ResourceManager.Sql.Models.AuthenticationName left, Azure.ResourceManager.Sql.Models.AuthenticationName right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthMetadataLookupMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthMetadataLookupMode(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode AzureAD { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode Paired { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode Windows { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode left, Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode left, Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode right) { throw null; } + public override string ToString() { throw null; } + } public enum AutoExecuteStatus { Default = 0, @@ -7481,6 +7522,18 @@ public enum BlobAuditingPolicyState public static bool operator !=(Azure.ResourceManager.Sql.Models.CatalogCollationType left, Azure.ResourceManager.Sql.Models.CatalogCollationType right) { throw null; } public override string ToString() { throw null; } } + public partial class CertificateInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CertificateInfo() { } + public string CertificateName { get { throw null; } } + public System.DateTimeOffset? ExpiryOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.CertificateInfo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.CertificateInfo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class ChangeLongTermRetentionBackupAccessTierParameters : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ChangeLongTermRetentionBackupAccessTierParameters(string backupStorageAccessTier, string operationMode) { } @@ -7839,23 +7892,59 @@ public enum DataMaskingState public static bool operator !=(Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours left, Azure.ResourceManager.Sql.Models.DiffBackupIntervalInHours right) { throw null; } public override string ToString() { throw null; } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct DistributedAvailabilityGroupReplicationMode : System.IEquatable + public partial class DistributedAvailabilityGroupDatabase : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public DistributedAvailabilityGroupReplicationMode(string value) { throw null; } - public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode Async { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode Sync { get { throw null; } } - public bool Equals(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode left, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode right) { throw null; } - public static implicit operator Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode left, Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupReplicationMode right) { throw null; } - public override string ToString() { throw null; } + public DistributedAvailabilityGroupDatabase() { } + public Azure.ResourceManager.Sql.Models.ReplicaConnectedState? ConnectedState { get { throw null; } } + public string DatabaseName { get { throw null; } set { } } + public int? InstanceRedoReplicationLagSeconds { get { throw null; } } + public System.Guid? InstanceReplicaId { get { throw null; } } + public int? InstanceSendReplicationLagSeconds { get { throw null; } } + public string LastBackupLsn { get { throw null; } } + public System.DateTimeOffset? LastBackupOn { get { throw null; } } + public string LastCommitLsn { get { throw null; } } + public System.DateTimeOffset? LastCommitOn { get { throw null; } } + public string LastHardenedLsn { get { throw null; } } + public System.DateTimeOffset? LastHardenedOn { get { throw null; } } + public string LastReceivedLsn { get { throw null; } } + public System.DateTimeOffset? LastReceivedOn { get { throw null; } } + public string LastSentLsn { get { throw null; } } + public System.DateTimeOffset? LastSentOn { get { throw null; } } + public string MostRecentLinkError { get { throw null; } } + public Azure.ResourceManager.Sql.Models.CertificateInfo PartnerAuthCertValidity { get { throw null; } } + public System.Guid? PartnerReplicaId { get { throw null; } } + public string ReplicaState { get { throw null; } } + public string SeedingProgress { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth? SynchronizationHealth { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupDatabase System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DistributedAvailabilityGroupSetRole : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DistributedAvailabilityGroupSetRole(Azure.ResourceManager.Sql.Models.InstanceRole instanceRole, Azure.ResourceManager.Sql.Models.RoleChangeType roleChangeType) { } + public Azure.ResourceManager.Sql.Models.InstanceRole InstanceRole { get { throw null; } } + public Azure.ResourceManager.Sql.Models.RoleChangeType RoleChangeType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupSetRole System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class DistributedAvailabilityGroupsFailoverContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DistributedAvailabilityGroupsFailoverContent(Azure.ResourceManager.Sql.Models.FailoverType failoverType) { } + public Azure.ResourceManager.Sql.Models.FailoverType FailoverType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.DistributedAvailabilityGroupsFailoverContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DnsRefreshConfigurationPropertiesStatus : System.IEquatable @@ -8244,6 +8333,42 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FailoverModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FailoverModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FailoverModeType Manual { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FailoverModeType None { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FailoverModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FailoverModeType left, Azure.ResourceManager.Sql.Models.FailoverModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FailoverModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FailoverModeType left, Azure.ResourceManager.Sql.Models.FailoverModeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FailoverType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FailoverType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FailoverType ForcedAllowDataLoss { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FailoverType Planned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FailoverType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FailoverType left, Azure.ResourceManager.Sql.Models.FailoverType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FailoverType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FailoverType left, Azure.ResourceManager.Sql.Models.FailoverType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct FreeLimitExhaustionBehavior : System.IEquatable { private readonly object _dummy; @@ -8262,6 +8387,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct FreemiumType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public FreemiumType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.FreemiumType Freemium { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.FreemiumType Regular { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.FreemiumType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.FreemiumType left, Azure.ResourceManager.Sql.Models.FreemiumType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.FreemiumType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.FreemiumType left, Azure.ResourceManager.Sql.Models.FreemiumType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct GeoBackupPolicyName : System.IEquatable { private readonly object _dummy; @@ -8301,6 +8444,42 @@ public enum GeoBackupPolicyState public static bool operator !=(Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType left, Azure.ResourceManager.Sql.Models.GeoSecondaryInstanceType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridSecondaryUsage : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridSecondaryUsage(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsage Active { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsage Passive { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsage right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.HybridSecondaryUsage (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.HybridSecondaryUsage left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsage right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct HybridSecondaryUsageDetected : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public HybridSecondaryUsageDetected(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected Active { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected Passive { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected left, Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected right) { throw null; } + public override string ToString() { throw null; } + } public enum ImplementationMethod { TSql = 0, @@ -8499,6 +8678,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct InstanceRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public InstanceRole(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.InstanceRole Primary { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.InstanceRole Secondary { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.InstanceRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.InstanceRole left, Azure.ResourceManager.Sql.Models.InstanceRole right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.InstanceRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.InstanceRole left, Azure.ResourceManager.Sql.Models.InstanceRole right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct JobAgentState : System.IEquatable { private readonly object _dummy; @@ -8754,6 +8951,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LinkRole : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LinkRole(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.LinkRole Primary { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.LinkRole Secondary { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.LinkRole other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.LinkRole left, Azure.ResourceManager.Sql.Models.LinkRole right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.LinkRole (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.LinkRole left, Azure.ResourceManager.Sql.Models.LinkRole right) { throw null; } + public override string ToString() { throw null; } + } public partial class LogSizeCapability : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { internal LogSizeCapability() { } @@ -9015,6 +9230,24 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType left, Azure.ResourceManager.Sql.Models.ManagedInstanceAdministratorType right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ManagedInstanceDatabaseFormat : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ManagedInstanceDatabaseFormat(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat AlwaysUpToDate { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat SqlServer2022 { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat left, Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat left, Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat right) { throw null; } + public override string ToString() { throw null; } + } public partial class ManagedInstanceDtcSecuritySettings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ManagedInstanceDtcSecuritySettings() { } @@ -9208,13 +9441,20 @@ public ManagedInstancePatch() { } public string AdministratorLogin { get { throw null; } set { } } public string AdministratorLoginPassword { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedInstanceExternalAdministrator Administrators { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.AuthMetadataLookupMode? AuthenticationMetadata { get { throw null; } set { } } public string Collation { get { throw null; } set { } } + public System.DateTimeOffset? CreateOn { get { throw null; } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? CurrentBackupStorageRedundancy { get { throw null; } } + public Azure.ResourceManager.Sql.Models.ManagedInstanceDatabaseFormat? DatabaseFormat { get { throw null; } set { } } public string DnsZone { get { throw null; } } public string DnsZonePartner { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.ExternalGovernanceStatus? ExternalGovernanceStatus { get { throw null; } } public string FullyQualifiedDomainName { get { throw null; } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsage? HybridSecondaryUsage { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get { throw null; } } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } public Azure.Core.ResourceIdentifier InstancePoolId { get { throw null; } set { } } + public bool? IsGeneralPurposeV2 { get { throw null; } set { } } public bool? IsPublicDataEndpointEnabled { get { throw null; } set { } } public bool? IsZoneRedundant { get { throw null; } set { } } public System.Uri KeyId { get { throw null; } set { } } @@ -9223,9 +9463,10 @@ public ManagedInstancePatch() { } public Azure.Core.ResourceIdentifier ManagedDnsZonePartner { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.ManagedServerCreateMode? ManagedInstanceCreateMode { get { throw null; } set { } } public string MinimalTlsVersion { get { throw null; } set { } } + public Azure.ResourceManager.Sql.Models.FreemiumType? PricingModel { get { throw null; } set { } } public Azure.Core.ResourceIdentifier PrimaryUserAssignedIdentityId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } - public Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Sql.Models.JobExecutionProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Sql.Models.ManagedInstanceProxyOverride? ProxyOverride { get { throw null; } set { } } public Azure.ResourceManager.Sql.Models.SqlBackupStorageRedundancy? RequestedBackupStorageRedundancy { get { throw null; } set { } } public System.DateTimeOffset? RestorePointInTime { get { throw null; } set { } } @@ -9233,11 +9474,14 @@ public ManagedInstancePatch() { } public Azure.ResourceManager.Sql.Models.SqlSku Sku { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SourceManagedInstanceId { get { throw null; } set { } } public string State { get { throw null; } } + public int? StorageIOps { get { throw null; } set { } } public int? StorageSizeInGB { get { throw null; } set { } } + public int? StorageThroughputMBps { get { throw null; } set { } } public Azure.Core.ResourceIdentifier SubnetId { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string TimezoneId { get { throw null; } set { } } public int? VCores { get { throw null; } set { } } + public string VirtualClusterId { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Sql.Models.ManagedInstancePatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -9296,37 +9540,6 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ManagedInstancePropertiesProvisioningState : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ManagedInstancePropertiesProvisioningState(string value) { throw null; } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Accepted { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Canceled { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Created { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Creating { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Deleted { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Deleting { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Failed { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState NotSpecified { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Registering { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Running { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Succeeded { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState TimedOut { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Unknown { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Unrecognized { get { throw null; } } - public static Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState Updating { get { throw null; } } - public bool Equals(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState left, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState right) { throw null; } - public static implicit operator Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState (string value) { throw null; } - public static bool operator !=(Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState left, Azure.ResourceManager.Sql.Models.ManagedInstancePropertiesProvisioningState right) { throw null; } - public override string ToString() { throw null; } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ManagedInstanceProxyOverride : System.IEquatable { private readonly object _dummy; @@ -9742,6 +9955,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class QueryMetricIntervalAutoGenerated : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal QueryMetricIntervalAutoGenerated() { } + public long? ExecutionCount { get { throw null; } } + public string IntervalStartTime { get { throw null; } } + public Azure.ResourceManager.Sql.Models.QueryTimeGrainType? IntervalType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Metrics { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.QueryMetricIntervalAutoGenerated System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } public partial class QueryMetricProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public QueryMetricProperties() { } @@ -9801,7 +10028,7 @@ public partial class QueryStatisticsProperties : System.ClientModel.Primitives.I internal QueryStatisticsProperties() { } public string DatabaseName { get { throw null; } } public string EndTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Intervals { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Intervals { get { throw null; } } public string QueryId { get { throw null; } } public string StartTime { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -10026,6 +10253,59 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + public partial class RefreshExternalGovernanceStatusOperationResultMI : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public RefreshExternalGovernanceStatusOperationResultMI() { } + public string ErrorMessage { get { throw null; } } + public string ManagedInstanceName { get { throw null; } } + public string QueuedTime { get { throw null; } } + public System.Guid? RequestId { get { throw null; } } + public string RequestType { get { throw null; } } + public string Status { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Sql.Models.RefreshExternalGovernanceStatusOperationResultMI System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicaConnectedState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicaConnectedState(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicaConnectedState Connected { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaConnectedState Disconnected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicaConnectedState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicaConnectedState left, Azure.ResourceManager.Sql.Models.ReplicaConnectedState right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicaConnectedState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicaConnectedState left, Azure.ResourceManager.Sql.Models.ReplicaConnectedState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicaSynchronizationHealth : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicaSynchronizationHealth(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth Healthy { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth NOTHealthy { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth PartiallyHealthy { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth left, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth left, Azure.ResourceManager.Sql.Models.ReplicaSynchronizationHealth right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ReplicationLinkState : System.IEquatable { @@ -10066,6 +10346,24 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReplicationModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReplicationModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.ReplicationModeType Async { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.ReplicationModeType Sync { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.ReplicationModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.ReplicationModeType left, Azure.ResourceManager.Sql.Models.ReplicationModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.ReplicationModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.ReplicationModeType left, Azure.ResourceManager.Sql.Models.ReplicationModeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ReplicaType : System.IEquatable { private readonly object _dummy; @@ -10119,6 +10417,24 @@ public enum RestorePointType Discrete = 1, } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RoleChangeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RoleChangeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.RoleChangeType Forced { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.RoleChangeType Planned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.RoleChangeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.RoleChangeType left, Azure.ResourceManager.Sql.Models.RoleChangeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.RoleChangeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.RoleChangeType left, Azure.ResourceManager.Sql.Models.RoleChangeType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct SampleSchemaName : System.IEquatable { private readonly object _dummy; @@ -10209,6 +10525,24 @@ public enum SecurityEventType SqlInjectionVulnerability = 1, SqlInjectionExploit = 2, } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SeedingModeType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SeedingModeType(string value) { throw null; } + public static Azure.ResourceManager.Sql.Models.SeedingModeType Automatic { get { throw null; } } + public static Azure.ResourceManager.Sql.Models.SeedingModeType Manual { get { throw null; } } + public bool Equals(Azure.ResourceManager.Sql.Models.SeedingModeType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Sql.Models.SeedingModeType left, Azure.ResourceManager.Sql.Models.SeedingModeType right) { throw null; } + public static implicit operator Azure.ResourceManager.Sql.Models.SeedingModeType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Sql.Models.SeedingModeType left, Azure.ResourceManager.Sql.Models.SeedingModeType right) { throw null; } + public override string ToString() { throw null; } + } public enum SensitivityLabelRank { None = 0, diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs index 842624c0ddec..2f717010b5fb 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupCollection.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.Sql.Models; using NUnit.Framework; namespace Azure.ResourceManager.Sql.Samples @@ -17,9 +18,9 @@ public partial class Sample_DistributedAvailabilityGroupCollection { [Test] [Ignore("Only validating compilation of examples")] - public async Task CreateOrUpdate_CreateADistributedAvailabilityGroup() + public async Task CreateOrUpdate_CreateADistributedAvailabilityGroupWithAllProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsCreate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsCreateMax.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -42,10 +43,61 @@ public async Task CreateOrUpdate_CreateADistributedAvailabilityGroup() string distributedAvailabilityGroupName = "dag"; DistributedAvailabilityGroupData data = new DistributedAvailabilityGroupData { - TargetDatabase = "testdb", - SourceEndpoint = "TCP://SERVER:7022", - PrimaryAvailabilityGroupName = "BoxLocalAg1", - SecondaryAvailabilityGroupName = "testcl", + PartnerAvailabilityGroupName = "BoxLocalAg1", + PartnerEndpoint = "TCP://SERVER:7022", + InstanceLinkRole = LinkRole.Primary, + InstanceAvailabilityGroupName = "testcl", + FailoverMode = FailoverModeType.None, + SeedingMode = SeedingModeType.Automatic, + Databases = {new DistributedAvailabilityGroupDatabase +{ +DatabaseName = "testdb", +}}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, distributedAvailabilityGroupName, data); + DistributedAvailabilityGroupResource 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 + DistributedAvailabilityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateADistributedAvailabilityGroupWithMinimalProperties() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsCreateMin.json + // this example is just showing the usage of "DistributedAvailabilityGroups_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // get the collection of this DistributedAvailabilityGroupResource + DistributedAvailabilityGroupCollection collection = managedInstance.GetDistributedAvailabilityGroups(); + + // invoke the operation + string distributedAvailabilityGroupName = "dag"; + DistributedAvailabilityGroupData data = new DistributedAvailabilityGroupData + { + PartnerAvailabilityGroupName = "BoxLocalAg1", + PartnerEndpoint = "TCP://SERVER:7022", + InstanceAvailabilityGroupName = "testcl", + Databases = {new DistributedAvailabilityGroupDatabase +{ +DatabaseName = "testdb", +}}, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, distributedAvailabilityGroupName, data); DistributedAvailabilityGroupResource result = lro.Value; @@ -61,7 +113,7 @@ public async Task CreateOrUpdate_CreateADistributedAvailabilityGroup() [Ignore("Only validating compilation of examples")] public async Task Get_GetsTheDistributedAvailabilityGroupInfo() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsGet.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -71,7 +123,7 @@ public async Task Get_GetsTheDistributedAvailabilityGroupInfo() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testcl"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -95,7 +147,7 @@ public async Task Get_GetsTheDistributedAvailabilityGroupInfo() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsAllDistributedAvailabilityGroupsInInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsListByInstance.json // this example is just showing the usage of "DistributedAvailabilityGroups_ListByInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +183,7 @@ public async Task GetAll_ListsAllDistributedAvailabilityGroupsInInstance() [Ignore("Only validating compilation of examples")] public async Task Exists_GetsTheDistributedAvailabilityGroupInfo() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsGet.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -141,7 +193,7 @@ public async Task Exists_GetsTheDistributedAvailabilityGroupInfo() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testcl"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -161,7 +213,7 @@ public async Task Exists_GetsTheDistributedAvailabilityGroupInfo() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsTheDistributedAvailabilityGroupInfo() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsGet.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -171,7 +223,7 @@ public async Task GetIfExists_GetsTheDistributedAvailabilityGroupInfo() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testcl"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupResource.cs index 6453f724d433..b4df451d700e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_DistributedAvailabilityGroupResource.cs @@ -20,7 +20,7 @@ public partial class Sample_DistributedAvailabilityGroupResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsTheDistributedAvailabilityGroupInfo() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsGet.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -30,7 +30,7 @@ public async Task Get_GetsTheDistributedAvailabilityGroupInfo() // this example assumes you already have this DistributedAvailabilityGroupResource created on azure // for more information of creating DistributedAvailabilityGroupResource, please refer to the document of DistributedAvailabilityGroupResource - string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testcl"; string distributedAvailabilityGroupName = "dag"; @@ -51,7 +51,7 @@ public async Task Get_GetsTheDistributedAvailabilityGroupInfo() [Ignore("Only validating compilation of examples")] public async Task Delete_InitiateADistributedAvailabilityGroupDrop() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsDelete.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsDelete.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -61,7 +61,7 @@ public async Task Delete_InitiateADistributedAvailabilityGroupDrop() // this example assumes you already have this DistributedAvailabilityGroupResource created on azure // for more information of creating DistributedAvailabilityGroupResource, please refer to the document of DistributedAvailabilityGroupResource - string subscriptionId = "f2669dff-5f08-45dd-b857-b2a60b72cdc9"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testcl"; string distributedAvailabilityGroupName = "dag"; @@ -78,7 +78,7 @@ public async Task Delete_InitiateADistributedAvailabilityGroupDrop() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateTheDistributedAvailabilityGroupReplicationModeBeforeDeletingIt() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2021-11-01-preview/examples/DistributedAvailabilityGroupsUpdate.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsUpdate.json // this example is just showing the usage of "DistributedAvailabilityGroups_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 @@ -98,7 +98,7 @@ public async Task Update_UpdateTheDistributedAvailabilityGroupReplicationModeBef // invoke the operation DistributedAvailabilityGroupData data = new DistributedAvailabilityGroupData { - ReplicationMode = DistributedAvailabilityGroupReplicationMode.Sync, + ReplicationMode = ReplicationModeType.Sync, }; ArmOperation lro = await distributedAvailabilityGroup.UpdateAsync(WaitUntil.Completed, data); DistributedAvailabilityGroupResource result = lro.Value; @@ -109,5 +109,71 @@ public async Task Update_UpdateTheDistributedAvailabilityGroupReplicationModeBef // 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 Failover_FailoverADistributedAvailabilityGroup() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsFailover.json + // this example is just showing the usage of "DistributedAvailabilityGroups_Failover" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DistributedAvailabilityGroupResource created on azure + // for more information of creating DistributedAvailabilityGroupResource, please refer to the document of DistributedAvailabilityGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + string distributedAvailabilityGroupName = "dag"; + ResourceIdentifier distributedAvailabilityGroupResourceId = DistributedAvailabilityGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + DistributedAvailabilityGroupResource distributedAvailabilityGroup = client.GetDistributedAvailabilityGroupResource(distributedAvailabilityGroupResourceId); + + // invoke the operation + DistributedAvailabilityGroupsFailoverContent content = new DistributedAvailabilityGroupsFailoverContent(FailoverType.ForcedAllowDataLoss); + ArmOperation lro = await distributedAvailabilityGroup.FailoverAsync(WaitUntil.Completed, content); + DistributedAvailabilityGroupResource 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 + DistributedAvailabilityGroupData 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 SetRole_SetDistributedAvailabilityGroupPrimaryReplicaToManagedInstance() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-08-01-preview/examples/DistributedAvailabilityGroupsSetRole.json + // this example is just showing the usage of "DistributedAvailabilityGroups_SetRole" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DistributedAvailabilityGroupResource created on azure + // for more information of creating DistributedAvailabilityGroupResource, please refer to the document of DistributedAvailabilityGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testcl"; + string distributedAvailabilityGroupName = "dag"; + ResourceIdentifier distributedAvailabilityGroupResourceId = DistributedAvailabilityGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName); + DistributedAvailabilityGroupResource distributedAvailabilityGroup = client.GetDistributedAvailabilityGroupResource(distributedAvailabilityGroupResourceId); + + // invoke the operation + DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole = new DistributedAvailabilityGroupSetRole(InstanceRole.Primary, RoleChangeType.Forced); + ArmOperation lro = await distributedAvailabilityGroup.SetRoleAsync(WaitUntil.Completed, distributedAvailabilityGroupSetRole); + DistributedAvailabilityGroupResource 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 + DistributedAvailabilityGroupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs index 3798912e79e7..4a4f113eab84 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_InstancePoolResource.cs @@ -173,7 +173,7 @@ public async Task GetUsages_ListInstancePoolUsages() [Ignore("Only validating compilation of examples")] public async Task GetManagedInstances_ListManagedInstancesByInstancePool() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePool.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceListByInstancePool.json // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +183,7 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePool() // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "Test1"; string instancePoolName = "pool1"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); @@ -206,7 +206,7 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePool() [Ignore("Only validating compilation of examples")] public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceListByInstancePoolWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_ListByInstancePool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -216,7 +216,7 @@ public async Task GetManagedInstances_ListManagedInstancesByInstancePoolWithExpa // this example assumes you already have this InstancePoolResource created on azure // for more information of creating InstancePoolResource, please refer to the document of InstancePoolResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "Test1"; string instancePoolName = "pool1"; ResourceIdentifier instancePoolResourceId = InstancePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancePoolName); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs index 207424cb13ca..9a9430a22bc0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_ManagedInstanceCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedInstanceWithAllProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceCreateMax.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceCreateMax.json // this example is just showing the usage of "ManagedInstances_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 @@ -51,6 +51,7 @@ public async Task CreateOrUpdate_CreateManagedInstanceWithAllProperties() AdministratorLoginPassword = "PLACEHOLDER", SubnetId = new ResourceIdentifier("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/vnet1/subnets/subnet1"), LicenseType = ManagedInstanceLicenseType.LicenseIncluded, + HybridSecondaryUsage = HybridSecondaryUsage.Passive, VCores = 8, StorageSizeInGB = 1024, Collation = "SQL_Latin1_General_CP1_CI_AS", @@ -74,6 +75,7 @@ public async Task CreateOrUpdate_CreateManagedInstanceWithAllProperties() { PrincipalType = SqlServicePrincipalType.SystemAssigned, }, + DatabaseFormat = ManagedInstanceDatabaseFormat.AlwaysUpToDate, Tags = { ["tagKey1"] = "TagValue1" @@ -93,7 +95,7 @@ public async Task CreateOrUpdate_CreateManagedInstanceWithAllProperties() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreateManagedInstanceWithMinimalProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceCreateMin.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceCreateMin.json // this example is just showing the usage of "ManagedInstances_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +117,7 @@ public async Task CreateOrUpdate_CreateManagedInstanceWithMinimalProperties() string managedInstanceName = "testinstance"; ManagedInstanceData data = new ManagedInstanceData(new AzureLocation("Japan East")) { - Sku = new SqlSku("GP_Gen4") + Sku = new SqlSku("GP_Gen5") { Tier = "GeneralPurpose", }, @@ -140,7 +142,7 @@ public async Task CreateOrUpdate_CreateManagedInstanceWithMinimalProperties() [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGet.json // this example is just showing the usage of "ManagedInstances_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 @@ -150,7 +152,40 @@ public async Task Get_GetManagedInstance() // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedInstanceResource + ManagedInstanceCollection collection = resourceGroupResource.GetManagedInstances(); + + // invoke the operation + string managedInstanceName = "testinstance"; + ManagedInstanceResource result = await collection.GetAsync(managedInstanceName); + + // 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 + ManagedInstanceData 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_GetManagedInstanceWhileResourceIsUpdating() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWhileUpdating.json + // this example is just showing the usage of "ManagedInstances_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -173,7 +208,7 @@ public async Task Get_GetManagedInstance() [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +218,7 @@ public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory( // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -206,7 +241,7 @@ public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory( [Ignore("Only validating compilation of examples")] public async Task GetAll_ListManagedInstancesByResourceGroup() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByResourceGroup.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceListByResourceGroup.json // this example is just showing the usage of "ManagedInstances_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 @@ -216,7 +251,7 @@ public async Task GetAll_ListManagedInstancesByResourceGroup() // 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 = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "Test1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -241,7 +276,7 @@ public async Task GetAll_ListManagedInstancesByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListManagedInstancesByResourceGroupWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceListByResourceGroupWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_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 @@ -251,7 +286,7 @@ public async Task GetAll_ListManagedInstancesByResourceGroupWithExpandAdministra // 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 = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "Test1"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -276,7 +311,7 @@ public async Task GetAll_ListManagedInstancesByResourceGroupWithExpandAdministra [Ignore("Only validating compilation of examples")] public async Task Exists_GetManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGet.json // this example is just showing the usage of "ManagedInstances_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 @@ -286,7 +321,36 @@ public async Task Exists_GetManagedInstance() // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedInstanceResource + ManagedInstanceCollection collection = resourceGroupResource.GetManagedInstances(); + + // invoke the operation + string managedInstanceName = "testinstance"; + bool result = await collection.ExistsAsync(managedInstanceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetManagedInstanceWhileResourceIsUpdating() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWhileUpdating.json + // this example is just showing the usage of "ManagedInstances_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -305,7 +369,7 @@ public async Task Exists_GetManagedInstance() [Ignore("Only validating compilation of examples")] public async Task Exists_GetManagedInstanceWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -315,7 +379,7 @@ public async Task Exists_GetManagedInstanceWithExpandAdministratorsActivedirecto // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -334,7 +398,48 @@ public async Task Exists_GetManagedInstanceWithExpandAdministratorsActivedirecto [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGet.json + // this example is just showing the usage of "ManagedInstances_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ManagedInstanceResource + ManagedInstanceCollection collection = resourceGroupResource.GetManagedInstances(); + + // invoke the operation + string managedInstanceName = "testinstance"; + NullableResponse response = await collection.GetIfExistsAsync(managedInstanceName); + ManagedInstanceResource 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 + ManagedInstanceData 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 GetIfExists_GetManagedInstanceWhileResourceIsUpdating() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWhileUpdating.json // this example is just showing the usage of "ManagedInstances_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 @@ -344,7 +449,7 @@ public async Task GetIfExists_GetManagedInstance() // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); @@ -375,7 +480,7 @@ public async Task GetIfExists_GetManagedInstance() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetManagedInstanceWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_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 @@ -385,7 +490,7 @@ public async Task GetIfExists_GetManagedInstanceWithExpandAdministratorsActivedi // 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 = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceResource.cs index 230c6e050d55..e88e8c1813ff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_ManagedInstanceResource.cs @@ -20,7 +20,7 @@ public partial class Sample_ManagedInstanceResource [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGet.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGet.json // this example is just showing the usage of "ManagedInstances_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 @@ -30,7 +30,37 @@ public async Task Get_GetManagedInstance() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "testrg"; + string managedInstanceName = "testinstance"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // invoke the operation + ManagedInstanceResource result = await managedInstance.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 + ManagedInstanceData 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_GetManagedInstanceWhileResourceIsUpdating() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWhileUpdating.json + // this example is just showing the usage of "ManagedInstances_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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -50,7 +80,7 @@ public async Task Get_GetManagedInstance() [Ignore("Only validating compilation of examples")] public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceGetWithExpandEqualsAdministrators.json // this example is just showing the usage of "ManagedInstances_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 @@ -60,7 +90,7 @@ public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory( // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20d7082a-0fc7-4468-82bd-542694d5042b"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -80,7 +110,7 @@ public async Task Get_GetManagedInstanceWithExpandAdministratorsActivedirectory( [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceDelete.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceDelete.json // this example is just showing the usage of "ManagedInstances_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 @@ -90,7 +120,7 @@ public async Task Delete_DeleteManagedInstance() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -106,7 +136,7 @@ public async Task Delete_DeleteManagedInstance() [Ignore("Only validating compilation of examples")] public async Task Update_RemoveMaintenancePolicyFromManagedInstanceSelectDefaultMaintenancePolicy() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceRemoveMaintenanceConfiguration.json // this example is just showing the usage of "ManagedInstances_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 @@ -116,7 +146,7 @@ public async Task Update_RemoveMaintenancePolicyFromManagedInstanceSelectDefault // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -125,7 +155,7 @@ public async Task Update_RemoveMaintenancePolicyFromManagedInstanceSelectDefault // invoke the operation ManagedInstancePatch patch = new ManagedInstancePatch { - MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/20d7082a-0fc7-4468-82bd-542694d5042b/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), + MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_Default"), }; ArmOperation lro = await managedInstance.UpdateAsync(WaitUntil.Completed, patch); ManagedInstanceResource result = lro.Value; @@ -141,7 +171,7 @@ public async Task Update_RemoveMaintenancePolicyFromManagedInstanceSelectDefault [Ignore("Only validating compilation of examples")] public async Task Update_UpdateManagedInstanceWithAllProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceUpdateMax.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceUpdateMax.json // this example is just showing the usage of "ManagedInstances_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 @@ -151,7 +181,7 @@ public async Task Update_UpdateManagedInstanceWithAllProperties() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -160,7 +190,7 @@ public async Task Update_UpdateManagedInstanceWithAllProperties() // invoke the operation ManagedInstancePatch patch = new ManagedInstancePatch { - Sku = new SqlSku("GP_Gen4") + Sku = new SqlSku("GP_Gen5") { Tier = "GeneralPurpose", Capacity = 8, @@ -172,14 +202,17 @@ public async Task Update_UpdateManagedInstanceWithAllProperties() AdministratorLogin = "dummylogin", AdministratorLoginPassword = "PLACEHOLDER", LicenseType = ManagedInstanceLicenseType.BasePrice, + HybridSecondaryUsage = HybridSecondaryUsage.Passive, VCores = 8, StorageSizeInGB = 448, Collation = "SQL_Latin1_General_CP1_CI_AS", IsPublicDataEndpointEnabled = false, ProxyOverride = ManagedInstanceProxyOverride.Redirect, - MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/20D7082A-0FC7-4468-82BD-542694D5042B/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), + MaintenanceConfigurationId = new ResourceIdentifier("/subscriptions/00000000-1111-2222-3333-444444444444/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/SQL_JapanEast_MI_1"), MinimalTlsVersion = "1.2", RequestedBackupStorageRedundancy = SqlBackupStorageRedundancy.Geo, + AuthenticationMetadata = AuthMetadataLookupMode.Windows, + DatabaseFormat = ManagedInstanceDatabaseFormat.AlwaysUpToDate, }; ArmOperation lro = await managedInstance.UpdateAsync(WaitUntil.Completed, patch); ManagedInstanceResource result = lro.Value; @@ -195,7 +228,7 @@ public async Task Update_UpdateManagedInstanceWithAllProperties() [Ignore("Only validating compilation of examples")] public async Task Update_UpdateManagedInstanceWithMinimalProperties() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceUpdateMin.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceUpdateMin.json // this example is just showing the usage of "ManagedInstances_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 @@ -205,7 +238,7 @@ public async Task Update_UpdateManagedInstanceWithMinimalProperties() // this example assumes you already have this ManagedInstanceResource created on azure // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource - string subscriptionId = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; string resourceGroupName = "testrg"; string managedInstanceName = "testinstance"; ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); @@ -329,7 +362,7 @@ public async Task GetInaccessibleManagedDatabases_ListInaccessibleManagedDatabas [Ignore("Only validating compilation of examples")] public async Task Failover_FailoverAManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/FailoverManagedInstance.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/FailoverManagedInstance.json // this example is just showing the usage of "ManagedInstances_Failover" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -356,7 +389,7 @@ public async Task Failover_FailoverAManagedInstance() [Ignore("Only validating compilation of examples")] public async Task GetOutboundNetworkDependencies_GetsTheCollectionOfOutboundNetworkDependenciesForTheGivenManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ListOutboundNetworkDependenciesByManagedInstance.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListOutboundNetworkDependenciesByManagedInstance.json // this example is just showing the usage of "ManagedInstances_ListOutboundNetworkDependenciesByManagedInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -381,11 +414,38 @@ public async Task GetOutboundNetworkDependencies_GetsTheCollectionOfOutboundNetw Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task RefreshStatus_RefreshExternalGovernanceEnablementStatus() + { + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceRefreshExternalGovernanceStatus.json + // this example is just showing the usage of "ManagedInstances_RefreshStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 ManagedInstanceResource created on azure + // for more information of creating ManagedInstanceResource, please refer to the document of ManagedInstanceResource + string subscriptionId = "00000000-1111-2222-3333-444444444444"; + string resourceGroupName = "sqlcrudtest-7398"; + string managedInstanceName = "sqlcrudtest-4645"; + ResourceIdentifier managedInstanceResourceId = ManagedInstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, managedInstanceName); + ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); + + // invoke the operation + ArmOperation lro = await managedInstance.RefreshStatusAsync(WaitUntil.Completed); + RefreshExternalGovernanceStatusOperationResultMI result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Start_StartsTheManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StartManagedInstance.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/StartManagedInstance.json // this example is just showing the usage of "ManagedInstances_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 @@ -402,16 +462,21 @@ public async Task Start_StartsTheManagedInstance() ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); // invoke the operation - await managedInstance.StartAsync(WaitUntil.Completed); + ArmOperation lro = await managedInstance.StartAsync(WaitUntil.Completed); + ManagedInstanceResource result = lro.Value; - Console.WriteLine("Succeeded"); + // 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 + ManagedInstanceData 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_StopsTheManagedInstance() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/StopManagedInstance.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/StopManagedInstance.json // this example is just showing the usage of "ManagedInstances_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 @@ -428,16 +493,21 @@ public async Task Stop_StopsTheManagedInstance() ManagedInstanceResource managedInstance = client.GetManagedInstanceResource(managedInstanceResourceId); // invoke the operation - await managedInstance.StopAsync(WaitUntil.Completed); + ArmOperation lro = await managedInstance.StopAsync(WaitUntil.Completed); + ManagedInstanceResource result = lro.Value; - Console.WriteLine("Succeeded"); + // 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 + ManagedInstanceData 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 GetTopQueries_ObtainListOfInstanceSTopResourceConsumingQueries() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesList.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceTopQueriesList.json // this example is just showing the usage of "ManagedInstances_ListByManagedInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -467,7 +537,7 @@ public async Task GetTopQueries_ObtainListOfInstanceSTopResourceConsumingQueries [Ignore("Only validating compilation of examples")] public async Task GetTopQueries_ObtainListOfInstanceSTopResourceConsumingQueriesFullBlownRequestAndResponse() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesListMax.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceTopQueriesListMax.json // this example is just showing the usage of "ManagedInstances_ListByManagedInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -497,7 +567,7 @@ public async Task GetTopQueries_ObtainListOfInstanceSTopResourceConsumingQueries [Ignore("Only validating compilation of examples")] public async Task GetTopQueries_ObtainListOfInstanceSTopResourceConsumingQueriesMinimalRequestAndResponse() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceTopQueriesListMin.json + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceTopQueriesListMin.json // this example is just showing the usage of "ManagedInstances_ListByManagedInstance" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index bde85a65d39e..52996c9615b2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -194,10 +194,10 @@ public async Task GetVirtualClusters_ListVirtualClusters() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetManagedInstances_ListManagedInstances() + public async Task GetInstancePools_ListInstancePoolsInTheSubscription() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceList.json - // this example is just showing the usage of "ManagedInstances_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsBySubscriptionId.json + // this example is just showing the usage of "InstancePools_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(); @@ -206,16 +206,16 @@ public async Task GetManagedInstances_ListManagedInstances() // 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 = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in subscriptionResource.GetManagedInstancesAsync()) + await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) { // 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 - ManagedInstanceData resourceData = item.Data; + InstancePoolData resourceData = item.Data; // for demo we just print out the id Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } @@ -225,10 +225,10 @@ public async Task GetManagedInstances_ListManagedInstances() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetManagedInstances_ListManagedInstancesWithExpandAdministratorsActivedirectory() + public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2022-08-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json - // this example is just showing the usage of "ManagedInstances_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByLocation.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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(); @@ -237,18 +237,16 @@ public async Task GetManagedInstances_ListManagedInstancesWithExpandAdministrato // 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 = "20D7082A-0FC7-4468-82BD-542694D5042B"; + string subscriptionId = "00000000-1111-2222-3333-444444444444"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (ManagedInstanceResource item in subscriptionResource.GetManagedInstancesAsync()) + AzureLocation locationName = new AzureLocation("japaneast"); + await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) { - // 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 - ManagedInstanceData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded on id: {item.Id}"); } Console.WriteLine("Succeeded"); @@ -256,10 +254,10 @@ public async Task GetManagedInstances_ListManagedInstancesWithExpandAdministrato [Test] [Ignore("Only validating compilation of examples")] - public async Task GetInstancePools_ListInstancePoolsInTheSubscription() + public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServer() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ListInstancePoolsBySubscriptionId.json - // this example is just showing the usage of "InstancePools_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByServer.json + // this example is just showing the usage of "LongTermRetentionBackups_ListByServer" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details 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(); @@ -273,13 +271,12 @@ public async Task GetInstancePools_ListInstancePoolsInTheSubscription() SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - await foreach (InstancePoolResource item in subscriptionResource.GetInstancePoolsAsync()) + AzureLocation locationName = new AzureLocation("japaneast"); + string longTermRetentionServerName = "testserver"; + await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) { - // 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 - InstancePoolData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + Console.WriteLine($"Succeeded on id: {item.Id}"); } Console.WriteLine("Succeeded"); @@ -287,10 +284,10 @@ public async Task GetInstancePools_ListInstancePoolsInTheSubscription() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentionBackupsUnderTheLocation() + public async Task GetManagedInstances_ListManagedInstances() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByLocation.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByLocation" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceList.json + // this example is just showing the usage of "ManagedInstances_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(); @@ -304,11 +301,13 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - AzureLocation locationName = new AzureLocation("japaneast"); - await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithLocationAsync(locationName)) + await foreach (ManagedInstanceResource item in subscriptionResource.GetManagedInstancesAsync()) { + // 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 + ManagedInstanceData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {item.Id}"); + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); @@ -316,10 +315,10 @@ public async Task GetLongTermRetentionBackupsWithLocation_GetAllLongTermRetentio [Test] [Ignore("Only validating compilation of examples")] - public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionBackupsUnderTheServer() + public async Task GetManagedInstances_ListManagedInstancesWithExpandAdministratorsActivedirectory() { - // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/LongTermRetentionBackupListByServer.json - // this example is just showing the usage of "LongTermRetentionBackups_ListByServer" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/sql/resource-manager/Microsoft.Sql/preview/2023-05-01-preview/examples/ManagedInstanceListWithExpandEqualsAdministrators.json + // this example is just showing the usage of "ManagedInstances_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(); @@ -333,12 +332,13 @@ public async Task GetLongTermRetentionBackupsWithServer_GetAllLongTermRetentionB SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation and iterate over the result - AzureLocation locationName = new AzureLocation("japaneast"); - string longTermRetentionServerName = "testserver"; - await foreach (LongTermRetentionBackupData item in subscriptionResource.GetLongTermRetentionBackupsWithServerAsync(locationName, longTermRetentionServerName)) + await foreach (ManagedInstanceResource item in subscriptionResource.GetManagedInstancesAsync()) { + // 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 + ManagedInstanceData resourceData = item.Data; // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {item.Id}"); + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } Console.WriteLine("Succeeded"); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs index 0064125ba412..09294771e0f0 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ArmSqlModelFactory.cs @@ -1695,26 +1695,6 @@ public static QueryStatistics QueryStatistics(ResourceIdentifier id = null, stri serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Database name of the database in which this query was executed. - /// Unique query id (unique within one database). - /// The start time for the metric (ISO-8601 format). - /// The end time for the metric (ISO-8601 format). - /// List of intervals with appropriate metric data. - /// A new instance for mocking. - public static QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, IEnumerable intervals = null) - { - intervals ??= new List(); - - return new QueryStatisticsProperties( - databaseName, - queryId, - startTime, - endTime, - intervals?.ToList(), - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The start time for the metric interval (ISO-8601 format). /// Interval type (length). @@ -3255,42 +3235,6 @@ public static SqlServerConnectionPolicyData SqlServerConnectionPolicyData(Resour serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The name of the target database. - /// The source endpoint. - /// The primary availability group name. - /// The secondary availability group name. - /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. - /// The distributed availability group id. - /// The source replica id. - /// The target replica id. - /// The link state. - /// The last hardened lsn. - /// A new instance for mocking. - public static DistributedAvailabilityGroupData DistributedAvailabilityGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string targetDatabase = null, string sourceEndpoint = null, string primaryAvailabilityGroupName = null, string secondaryAvailabilityGroupName = null, DistributedAvailabilityGroupReplicationMode? replicationMode = null, Guid? distributedAvailabilityGroupId = null, Guid? sourceReplicaId = null, Guid? targetReplicaId = null, string linkState = null, string lastHardenedLsn = null) - { - return new DistributedAvailabilityGroupData( - id, - name, - resourceType, - systemData, - targetDatabase, - sourceEndpoint, - primaryAvailabilityGroupName, - secondaryAvailabilityGroupName, - replicationMode, - distributedAvailabilityGroupId, - sourceReplicaId, - targetReplicaId, - linkState, - lastHardenedLsn, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -4933,548 +4877,288 @@ public static ManagedDatabaseStartMoveDefinition ManagedDatabaseStartMoveDefinit return new ManagedDatabaseStartMoveDefinition(destinationManagedDatabaseId, operationMode, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. + /// Specifies the state of ledger digest upload. + /// A new instance for mocking. + public static ManagedLedgerDigestUploadData ManagedLedgerDigestUploadData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string digestStorageEndpoint = null, ManagedLedgerDigestUploadsState? state = null) + { + return new ManagedLedgerDigestUploadData( + id, + name, + resourceType, + systemData, + digestStorageEndpoint, + state, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The edition of the database. + /// The service level objective name of the database. + /// The elastic pool name of the database. + /// The last available backup date. + /// The resource ids of the user assigned identities to use. + /// A new instance for mocking. + public static RecoverableDatabaseData RecoverableDatabaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string edition = null, string serviceLevelObjective = null, string elasticPoolName = null, DateTimeOffset? lastAvailableBackupOn = null, IDictionary keys = null) + { + keys ??= new Dictionary(); + + return new RecoverableDatabaseData( + id, + name, + resourceType, + systemData, + edition, + serviceLevelObjective, + elasticPoolName, + lastAvailableBackupOn, + keys, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// The tags. /// The location. - /// The Azure Active Directory identity of the managed instance. - /// Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, BC_Gen5, BC_G8IM, BC_G8IH. - /// - /// - /// Specifies the mode of database creation. - /// - /// Default: Regular instance creation. - /// - /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. - /// - /// The fully qualified domain name of the managed instance. - /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). - /// The administrator login password (required for managed instance creation). - /// Subnet resource ID for the managed instance. - /// The state of the managed instance. - /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). - /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. - /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. - /// Collation of the managed instance. - /// The Dns Zone that the managed instance is in. - /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. - /// Whether or not the public data endpoint is enabled. - /// The resource identifier of the source managed instance associated with create operation of this instance. - /// Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - /// Connection type used for connecting to the instance. - /// - /// Id of the timezone. Allowed values are timezones supported by Windows. - /// Windows keeps details on supported timezones, including the id, in registry under - /// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. - /// You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. - /// List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. - /// An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". - /// - /// The Id of the instance pool this managed server belongs to. - /// Specifies maintenance configuration id to apply to this managed instance. - /// List of private endpoint connections on a managed instance. - /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. - /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). - /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). - /// Whether or not the multi-az is enabled. - /// The resource id of a user assigned identity to be used by default. - /// A CMK URI of the key to use for encryption. - /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. - /// The managed instance's service principal. - /// A new instance for mocking. - public static ManagedInstanceData ManagedInstanceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, SqlSku sku = null, ManagedInstancePropertiesProvisioningState? provisioningState = null, ManagedServerCreateMode? managedInstanceCreateMode = null, string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, ResourceIdentifier subnetId = null, string state = null, ManagedInstanceLicenseType? licenseType = null, int? vCores = null, int? storageSizeInGB = null, string collation = null, string dnsZone = null, ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = null, ResourceIdentifier sourceManagedInstanceId = null, DateTimeOffset? restorePointInTime = null, ManagedInstanceProxyOverride? proxyOverride = null, string timezoneId = null, ResourceIdentifier instancePoolId = null, ResourceIdentifier maintenanceConfigurationId = null, IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, SqlBackupStorageRedundancy? currentBackupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isZoneRedundant = null, ResourceIdentifier primaryUserAssignedIdentityId = null, Uri keyId = null, ManagedInstanceExternalAdministrator administrators = null, SqlServicePrincipal servicePrincipal = null) + /// The name and tier of the SKU. + /// The name of the database. + /// The max size of the database expressed in bytes. + /// The creation date of the database (ISO8601 format). + /// The deletion date of the database (ISO8601 format). + /// The earliest restore date of the database (ISO8601 format). + /// The storage account type used to store backups for this database. + /// The resource ids of the user assigned identities to use. + /// A new instance for mocking. + public static RestorableDroppedDatabaseData RestorableDroppedDatabaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, string databaseName = null, long? maxSizeBytes = null, DateTimeOffset? createdOn = null, DateTimeOffset? deletedOn = null, DateTimeOffset? earliestRestoreOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, IDictionary keys = null) { tags ??= new Dictionary(); - privateEndpointConnections ??= new List(); + keys ??= new Dictionary(); - return new ManagedInstanceData( + return new RestorableDroppedDatabaseData( id, name, resourceType, systemData, tags, location, - identity, sku, + databaseName, + maxSizeBytes, + createdOn, + deletedOn, + earliestRestoreOn, + backupStorageRedundancy, + keys, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Value of the server configuration option. + /// Provisioning state of server configuration option. + /// A new instance for mocking. + public static ManagedInstanceServerConfigurationOptionData ManagedInstanceServerConfigurationOptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? serverConfigurationOptionValue = null, JobExecutionProvisioningState? provisioningState = null) + { + return new ManagedInstanceServerConfigurationOptionData( + id, + name, + resourceType, + systemData, + serverConfigurationOptionValue, provisioningState, - managedInstanceCreateMode, - fullyQualifiedDomainName, - administratorLogin, - administratorLoginPassword, - subnetId, - state, - licenseType, - vCores, - storageSizeInGB, - collation, - dnsZone, - managedDnsZonePartner, - isPublicDataEndpointEnabled, - sourceManagedInstanceId, - restorePointInTime, - proxyOverride, - timezoneId, - instancePoolId, - maintenanceConfigurationId, - privateEndpointConnections?.ToList(), - minimalTlsVersion, - currentBackupStorageRedundancy, - requestedBackupStorageRedundancy, - isZoneRedundant, - primaryUserAssignedIdentityId, - keyId, - administrators, - servicePrincipal, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Resource ID. - /// Private endpoint connection properties. - /// A new instance for mocking. - public static ManagedInstancePecProperty ManagedInstancePecProperty(ResourceIdentifier id = null, ManagedInstancePrivateEndpointConnectionProperties properties = null) + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The description of the schedule. + /// The time zone of the schedule. + /// Schedule list. + /// Next action to be executed (Start or Stop). + /// Timestamp when the next action will be executed in the corresponding schedule time zone. + /// A new instance for mocking. + public static ManagedInstanceStartStopScheduleData ManagedInstanceStartStopScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string timeZoneId = null, IEnumerable scheduleList = null, string nextRunAction = null, string nextExecutionTime = null) { - return new ManagedInstancePecProperty(id, properties, serializedAdditionalRawData: null); + scheduleList ??= new List(); + + return new ManagedInstanceStartStopScheduleData( + id, + name, + resourceType, + systemData, + description, + timeZoneId, + scheduleList?.ToList(), + nextRunAction, + nextExecutionTime, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The Azure Active Directory application object id. - /// The Azure Active Directory application client id. - /// The Azure Active Directory tenant id. - /// Service principal type. - /// A new instance for mocking. - public static SqlServicePrincipal SqlServicePrincipal(Guid? principalId = null, Guid? clientId = null, Guid? tenantId = null, SqlServicePrincipalType? principalType = null) + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Specifies the state of the transparent data encryption. + /// A new instance for mocking. + public static LogicalDatabaseTransparentDataEncryptionData LogicalDatabaseTransparentDataEncryptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TransparentDataEncryptionState? state = null) { - return new SqlServicePrincipal(principalId, clientId, tenantId, principalType, serializedAdditionalRawData: null); + return new LogicalDatabaseTransparentDataEncryptionData( + id, + name, + resourceType, + systemData, + state, + serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Managed instance sku. - /// Managed instance identity. - /// Resource tags. - /// - /// - /// Specifies the mode of database creation. - /// - /// Default: Regular instance creation. - /// - /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. - /// - /// The fully qualified domain name of the managed instance. - /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). - /// The administrator login password (required for managed instance creation). - /// Subnet resource ID for the managed instance. - /// The state of the managed instance. - /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). - /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. - /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. - /// Collation of the managed instance. - /// The Dns Zone that the managed instance is in. - /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. - /// Whether or not the public data endpoint is enabled. - /// The resource identifier of the source managed instance associated with create operation of this instance. - /// Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. - /// Connection type used for connecting to the instance. - /// - /// Id of the timezone. Allowed values are timezones supported by Windows. - /// Windows keeps details on supported timezones, including the id, in registry under - /// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. - /// You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. - /// List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. - /// An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". - /// - /// The Id of the instance pool this managed server belongs to. - /// Specifies maintenance configuration id to apply to this managed instance. - /// List of private endpoint connections on a managed instance. - /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. - /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). - /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). - /// Whether or not the multi-az is enabled. - /// The resource id of a user assigned identity to be used by default. - /// A CMK URI of the key to use for encryption. - /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. - /// The managed instance's service principal. - /// A new instance for mocking. - public static ManagedInstancePatch ManagedInstancePatch(SqlSku sku = null, ManagedServiceIdentity identity = null, IDictionary tags = null, ManagedInstancePropertiesProvisioningState? provisioningState = null, ManagedServerCreateMode? managedInstanceCreateMode = null, string fullyQualifiedDomainName = null, string administratorLogin = null, string administratorLoginPassword = null, ResourceIdentifier subnetId = null, string state = null, ManagedInstanceLicenseType? licenseType = null, int? vCores = null, int? storageSizeInGB = null, string collation = null, string dnsZone = null, ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = null, ResourceIdentifier sourceManagedInstanceId = null, DateTimeOffset? restorePointInTime = null, ManagedInstanceProxyOverride? proxyOverride = null, string timezoneId = null, ResourceIdentifier instancePoolId = null, ResourceIdentifier maintenanceConfigurationId = null, IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, SqlBackupStorageRedundancy? currentBackupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isZoneRedundant = null, ResourceIdentifier primaryUserAssignedIdentityId = null, Uri keyId = null, ManagedInstanceExternalAdministrator administrators = null, SqlServicePrincipal servicePrincipal = null) + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The name of the database the operation is being performed on. + /// The name of operation. + /// The friendly name of operation. + /// The percentage of the operation completed. + /// The name of the server. + /// The operation start time. + /// The operation state. + /// The operation error code. + /// The operation error description. + /// The operation error severity. + /// Whether or not the error is a user error. + /// The estimated completion time of the operation. + /// The operation description. + /// Whether the operation can be cancelled. + /// The operation phase details. + /// A new instance for mocking. + public static DatabaseOperationData DatabaseOperationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = null, string serverName = null, DateTimeOffset? startOn = null, ManagementOperationState? state = null, int? errorCode = null, string errorDescription = null, int? errorSeverity = null, bool? isUserError = null, DateTimeOffset? estimatedCompleteOn = null, string description = null, bool? isCancellable = null, DatabaseOperationPhaseDetails operationPhaseDetails = null) { - tags ??= new Dictionary(); - privateEndpointConnections ??= new List(); - - return new ManagedInstancePatch( - sku, - identity, - tags, - provisioningState, - managedInstanceCreateMode, - fullyQualifiedDomainName, - administratorLogin, - administratorLoginPassword, - subnetId, + return new DatabaseOperationData( + id, + name, + resourceType, + systemData, + databaseName, + operation, + operationFriendlyName, + percentComplete, + serverName, + startOn, state, - licenseType, - vCores, - storageSizeInGB, - collation, - dnsZone, - managedDnsZonePartner, - isPublicDataEndpointEnabled, - sourceManagedInstanceId, - restorePointInTime, - proxyOverride, - timezoneId, - instancePoolId, - maintenanceConfigurationId, - privateEndpointConnections?.ToList(), - minimalTlsVersion, - currentBackupStorageRedundancy, - requestedBackupStorageRedundancy, - isZoneRedundant, - primaryUserAssignedIdentityId, - keyId, - administrators, - servicePrincipal, + errorCode, + errorDescription, + errorSeverity, + isUserError, + estimatedCompleteOn, + description, + isCancellable, + operationPhaseDetails, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The type of service accessed by the managed instance service, e.g., Azure Storage, Azure Active Directory, etc. - /// The endpoints that the managed instance service communicates with in order to function correctly. - /// A new instance for mocking. - public static SqlOutboundEnvironmentEndpoint SqlOutboundEnvironmentEndpoint(string category = null, IEnumerable endpoints = null) - { - endpoints ??= new List(); - - return new SqlOutboundEnvironmentEndpoint(category, endpoints?.ToList(), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The domain name of the dependency. - /// The IP Addresses and Ports used when connecting to DomainName. - /// A new instance for mocking. - public static ManagedInstanceEndpointDependency ManagedInstanceEndpointDependency(string domainName = null, IEnumerable endpointDetails = null) + /// Initializes a new instance of . + /// The operation phase. + /// The operation phase information. + /// A new instance for mocking. + public static DatabaseOperationPhaseDetails DatabaseOperationPhaseDetails(DatabaseOperationPhase? phase = null, IReadOnlyDictionary phaseInformation = null) { - endpointDetails ??= new List(); - - return new ManagedInstanceEndpointDependency(domainName, endpointDetails?.ToList(), serializedAdditionalRawData: null); - } + phaseInformation ??= new Dictionary(); - /// Initializes a new instance of . - /// The port an endpoint is connected to. - /// A new instance for mocking. - public static ManagedInstanceEndpointDetail ManagedInstanceEndpointDetail(int? port = null) - { - return new ManagedInstanceEndpointDetail(port, serializedAdditionalRawData: null); + return new DatabaseOperationPhaseDetails(phase, phaseInformation, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// Requested number of top queries. - /// Aggregation function used to calculate query metrics. - /// Metric used to rank queries. - /// Interval type (length). - /// The start time for the metric (ISO-8601 format). - /// The end time for the metric (ISO-8601 format). - /// List of top resource consuming queries with appropriate metric data. - /// A new instance for mocking. - public static TopQueries TopQueries(int? numberOfQueries = null, string aggregationFunction = null, string observationMetric = null, QueryTimeGrainType? intervalType = null, string startTime = null, string endTime = null, IEnumerable queries = null) + /// Initializes a new instance of . + /// Resource ID. + /// Resource name. + /// Resource type. + /// The start IP address of the firewall rule. Must be IPv6 format. + /// The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpv6Address. + /// A new instance for mocking. + public static IPv6FirewallRuleData IPv6FirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType? resourceType = null, string startIPv6Address = null, string endIPv6Address = null) { - queries ??= new List(); - - return new TopQueries( - numberOfQueries, - aggregationFunction, - observationMetric, - intervalType, - startTime, - endTime, - queries?.ToList(), - serializedAdditionalRawData: null); + return new IPv6FirewallRuleData( + id, + name, + resourceType, + serializedAdditionalRawData: null, + startIPv6Address, + endIPv6Address); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The digest storage endpoint, which must be either an Azure blob storage endpoint or an URI for Azure Confidential Ledger. - /// Specifies the state of ledger digest upload. - /// A new instance for mocking. - public static ManagedLedgerDigestUploadData ManagedLedgerDigestUploadData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string digestStorageEndpoint = null, ManagedLedgerDigestUploadsState? state = null) + /// The baseline set result. + /// A new instance for mocking. + public static SqlVulnerabilityAssessmentBaselineData SqlVulnerabilityAssessmentBaselineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary>> results = null) { - return new ManagedLedgerDigestUploadData( + results ??= new Dictionary>>(); + + return new SqlVulnerabilityAssessmentBaselineData( id, name, resourceType, systemData, - digestStorageEndpoint, - state, + results, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The edition of the database. - /// The service level objective name of the database. - /// The elastic pool name of the database. - /// The last available backup date. - /// The resource ids of the user assigned identities to use. - /// A new instance for mocking. - public static RecoverableDatabaseData RecoverableDatabaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string edition = null, string serviceLevelObjective = null, string elasticPoolName = null, DateTimeOffset? lastAvailableBackupOn = null, IDictionary keys = null) + /// The latest scan flag. + /// The rule baseline result list. + /// A new instance for mocking. + public static SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isLatestScan = null, IDictionary>> results = null) { - keys ??= new Dictionary(); + results ??= new Dictionary>>(); - return new RecoverableDatabaseData( + return new SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent( id, name, resourceType, systemData, - edition, - serviceLevelObjective, - elasticPoolName, - lastAvailableBackupOn, - keys, + isLatestScan, + results, 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 name and tier of the SKU. - /// The name of the database. - /// The max size of the database expressed in bytes. - /// The creation date of the database (ISO8601 format). - /// The deletion date of the database (ISO8601 format). - /// The earliest restore date of the database (ISO8601 format). - /// The storage account type used to store backups for this database. - /// The resource ids of the user assigned identities to use. - /// A new instance for mocking. - public static RestorableDroppedDatabaseData RestorableDroppedDatabaseData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, string databaseName = null, long? maxSizeBytes = null, DateTimeOffset? createdOn = null, DateTimeOffset? deletedOn = null, DateTimeOffset? earliestRestoreOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, IDictionary keys = null) + /// The rule baseline result. + /// A new instance for mocking. + public static SqlVulnerabilityAssessmentBaselineRuleData SqlVulnerabilityAssessmentBaselineRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable> results = null) { - tags ??= new Dictionary(); - keys ??= new Dictionary(); + results ??= new List>(); - return new RestorableDroppedDatabaseData( - id, - name, - resourceType, - systemData, - tags, - location, - sku, - databaseName, - maxSizeBytes, - createdOn, - deletedOn, - earliestRestoreOn, - backupStorageRedundancy, - keys, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Value of the server configuration option. - /// Provisioning state of server configuration option. - /// A new instance for mocking. - public static ManagedInstanceServerConfigurationOptionData ManagedInstanceServerConfigurationOptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? serverConfigurationOptionValue = null, JobExecutionProvisioningState? provisioningState = null) - { - return new ManagedInstanceServerConfigurationOptionData( - id, - name, - resourceType, - systemData, - serverConfigurationOptionValue, - provisioningState, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The description of the schedule. - /// The time zone of the schedule. - /// Schedule list. - /// Next action to be executed (Start or Stop). - /// Timestamp when the next action will be executed in the corresponding schedule time zone. - /// A new instance for mocking. - public static ManagedInstanceStartStopScheduleData ManagedInstanceStartStopScheduleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string description = null, string timeZoneId = null, IEnumerable scheduleList = null, string nextRunAction = null, string nextExecutionTime = null) - { - scheduleList ??= new List(); - - return new ManagedInstanceStartStopScheduleData( - id, - name, - resourceType, - systemData, - description, - timeZoneId, - scheduleList?.ToList(), - nextRunAction, - nextExecutionTime, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// Specifies the state of the transparent data encryption. - /// A new instance for mocking. - public static LogicalDatabaseTransparentDataEncryptionData LogicalDatabaseTransparentDataEncryptionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TransparentDataEncryptionState? state = null) - { - return new LogicalDatabaseTransparentDataEncryptionData( - id, - name, - resourceType, - systemData, - state, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The name of the database the operation is being performed on. - /// The name of operation. - /// The friendly name of operation. - /// The percentage of the operation completed. - /// The name of the server. - /// The operation start time. - /// The operation state. - /// The operation error code. - /// The operation error description. - /// The operation error severity. - /// Whether or not the error is a user error. - /// The estimated completion time of the operation. - /// The operation description. - /// Whether the operation can be cancelled. - /// The operation phase details. - /// A new instance for mocking. - public static DatabaseOperationData DatabaseOperationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string databaseName = null, string operation = null, string operationFriendlyName = null, int? percentComplete = null, string serverName = null, DateTimeOffset? startOn = null, ManagementOperationState? state = null, int? errorCode = null, string errorDescription = null, int? errorSeverity = null, bool? isUserError = null, DateTimeOffset? estimatedCompleteOn = null, string description = null, bool? isCancellable = null, DatabaseOperationPhaseDetails operationPhaseDetails = null) - { - return new DatabaseOperationData( - id, - name, - resourceType, - systemData, - databaseName, - operation, - operationFriendlyName, - percentComplete, - serverName, - startOn, - state, - errorCode, - errorDescription, - errorSeverity, - isUserError, - estimatedCompleteOn, - description, - isCancellable, - operationPhaseDetails, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The operation phase. - /// The operation phase information. - /// A new instance for mocking. - public static DatabaseOperationPhaseDetails DatabaseOperationPhaseDetails(DatabaseOperationPhase? phase = null, IReadOnlyDictionary phaseInformation = null) - { - phaseInformation ??= new Dictionary(); - - return new DatabaseOperationPhaseDetails(phase, phaseInformation, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Resource ID. - /// Resource name. - /// Resource type. - /// The start IP address of the firewall rule. Must be IPv6 format. - /// The end IP address of the firewall rule. Must be IPv6 format. Must be greater than or equal to startIpv6Address. - /// A new instance for mocking. - public static IPv6FirewallRuleData IPv6FirewallRuleData(ResourceIdentifier id = null, string name = null, ResourceType? resourceType = null, string startIPv6Address = null, string endIPv6Address = null) - { - return new IPv6FirewallRuleData( - id, - name, - resourceType, - serializedAdditionalRawData: null, - startIPv6Address, - endIPv6Address); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The baseline set result. - /// A new instance for mocking. - public static SqlVulnerabilityAssessmentBaselineData SqlVulnerabilityAssessmentBaselineData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary>> results = null) - { - results ??= new Dictionary>>(); - - return new SqlVulnerabilityAssessmentBaselineData( - id, - name, - resourceType, - systemData, - results, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The latest scan flag. - /// The rule baseline result list. - /// A new instance for mocking. - public static SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isLatestScan = null, IDictionary>> results = null) - { - results ??= new Dictionary>>(); - - return new SqlVulnerabilityAssessmentBaselineCreateOrUpdateContent( - id, - name, - resourceType, - systemData, - isLatestScan, - results, - serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The rule baseline result. - /// A new instance for mocking. - public static SqlVulnerabilityAssessmentBaselineRuleData SqlVulnerabilityAssessmentBaselineRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable> results = null) - { - results ??= new List>(); - - return new SqlVulnerabilityAssessmentBaselineRuleData( + return new SqlVulnerabilityAssessmentBaselineRuleData( id, name, resourceType, @@ -5767,145 +5451,510 @@ public static PartnerServerInfo PartnerServerInfo(ResourceIdentifier id = null, /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). /// The Dns Zone that the managed instance pool is in. /// Specifies maintenance configuration id to apply to this managed instance. - /// A new instance for mocking. - public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + /// A new instance for mocking. + public static InstancePoolData InstancePoolData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SqlSku sku = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + { + tags ??= new Dictionary(); + + return new InstancePoolData( + id, + name, + resourceType, + systemData, + tags, + location, + sku, + subnetId, + vCores, + licenseType, + dnsZone, + maintenanceConfigurationId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name and tier of the SKU. + /// Resource tags. + /// Resource ID of the subnet to place this instance pool in. + /// Count of vCores belonging to this instance pool. + /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). + /// The Dns Zone that the managed instance pool is in. + /// Specifies maintenance configuration id to apply to this managed instance. + /// A new instance for mocking. + public static InstancePoolPatch InstancePoolPatch(SqlSku sku = null, IDictionary tags = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + { + tags ??= new Dictionary(); + + return new InstancePoolPatch( + sku, + tags, + subnetId, + vCores, + licenseType, + dnsZone, + maintenanceConfigurationId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The server name that the backup database belong to. + /// The create time of the server. + /// The name of the database the backup belong to. + /// The delete time of the database. + /// The time the backup was taken. + /// The time the long term retention backup will expire. + /// The storage redundancy type of the backup. + /// The storage redundancy type of the backup. + /// The setting whether the LTR backup is immutable. + /// The BackupStorageAccessTier for the LTR backup. + /// A new instance for mocking. + public static LongTermRetentionBackupData LongTermRetentionBackupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string serverName = null, DateTimeOffset? serverCreateOn = null, string databaseName = null, DateTimeOffset? databaseDeletedOn = null, DateTimeOffset? backupOn = null, DateTimeOffset? backupExpireOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isBackupImmutable = null, SqlBackupStorageAccessTier? backupStorageAccessTier = null) + { + return new LongTermRetentionBackupData( + id, + name, + resourceType, + systemData, + serverName, + serverCreateOn, + databaseName, + databaseDeletedOn, + backupOn, + backupExpireOn, + backupStorageRedundancy, + requestedBackupStorageRedundancy, + isBackupImmutable, + backupStorageAccessTier, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Request Id. + /// Operation type. + /// Source backup resource id. + /// Target backup resource id. + /// The storage redundancy type of the copied backup. + /// Operation status. + /// Progress message. + /// A new instance for mocking. + public static LongTermRetentionBackupOperationResult LongTermRetentionBackupOperationResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? requestId = null, string operationType = null, ResourceIdentifier fromBackupResourceId = null, ResourceIdentifier toBackupResourceId = null, SqlBackupStorageRedundancy? targetBackupStorageRedundancy = null, string status = null, string message = null) + { + return new LongTermRetentionBackupOperationResult( + id, + name, + resourceType, + systemData, + requestId, + operationType, + fromBackupResourceId, + toBackupResourceId, + targetBackupStorageRedundancy, + status, + message, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The setting whether to make LTR backups immutable. + /// The BackupStorageAccessTier for the LTR backups. + /// The weekly retention policy for an LTR backup in an ISO 8601 format. + /// The monthly retention policy for an LTR backup in an ISO 8601 format. + /// The yearly retention policy for an LTR backup in an ISO 8601 format. + /// The week of year to take the yearly backup in an ISO 8601 format. + /// A new instance for mocking. + public static LongTermRetentionPolicyData LongTermRetentionPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? makeBackupsImmutable = null, SqlBackupStorageAccessTier? backupStorageAccessTier = null, string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = null) + { + return new LongTermRetentionPolicyData( + id, + name, + resourceType, + systemData, + makeBackupsImmutable, + backupStorageAccessTier, + weeklyRetention, + monthlyRetention, + yearlyRetention, + weekOfYear, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The Azure Active Directory identity of the managed instance. + /// Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, BC_Gen5, BC_G8IM, BC_G8IH. + /// Provisioning state of managed instance. + /// + /// Specifies the mode of database creation. + /// + /// Default: Regular instance creation. + /// + /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. + /// + /// The fully qualified domain name of the managed instance. + /// Whether or not this is a GPv2 variant of General Purpose edition. + /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + /// The administrator login password (required for managed instance creation). + /// Subnet resource ID for the managed instance. + /// The state of the managed instance. + /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). + /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage throughput MBps parameter is not supported in the instance create/update operation. + /// Collation of the managed instance. + /// The Dns Zone that the managed instance is in. + /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. + /// Whether or not the public data endpoint is enabled. + /// The resource identifier of the source managed instance associated with create operation of this instance. + /// Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + /// Connection type used for connecting to the instance. + /// + /// Id of the timezone. Allowed values are timezones supported by Windows. + /// Windows keeps details on supported timezones, including the id, in registry under + /// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + /// You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + /// List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + /// An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + /// + /// The Id of the instance pool this managed server belongs to. + /// Specifies maintenance configuration id to apply to this managed instance. + /// List of private endpoint connections on a managed instance. + /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// Whether or not the multi-az is enabled. + /// The resource id of a user assigned identity to be used by default. + /// A CMK URI of the key to use for encryption. + /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. + /// The managed instance's service principal. + /// Virtual cluster resource id for the Managed Instance. + /// Status of external governance. + /// Weather or not Managed Instance is freemium. + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + /// The managed instance's authentication metadata lookup mode. + /// Specifies the internal format of instance databases specific to the SQL engine version. + /// A new instance for mocking. + public static ManagedInstanceData ManagedInstanceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, SqlSku sku = null, JobExecutionProvisioningState? provisioningState = null, ManagedServerCreateMode? managedInstanceCreateMode = null, string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = null, string administratorLogin = null, string administratorLoginPassword = null, ResourceIdentifier subnetId = null, string state = null, ManagedInstanceLicenseType? licenseType = null, HybridSecondaryUsage? hybridSecondaryUsage = null, HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = null, int? vCores = null, int? storageSizeInGB = null, int? storageIOps = null, int? storageThroughputMBps = null, string collation = null, string dnsZone = null, ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = null, ResourceIdentifier sourceManagedInstanceId = null, DateTimeOffset? restorePointInTime = null, ManagedInstanceProxyOverride? proxyOverride = null, string timezoneId = null, ResourceIdentifier instancePoolId = null, ResourceIdentifier maintenanceConfigurationId = null, IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, SqlBackupStorageRedundancy? currentBackupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isZoneRedundant = null, ResourceIdentifier primaryUserAssignedIdentityId = null, Uri keyId = null, ManagedInstanceExternalAdministrator administrators = null, SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, ExternalGovernanceStatus? externalGovernanceStatus = null, FreemiumType? pricingModel = null, DateTimeOffset? createOn = null, AuthMetadataLookupMode? authenticationMetadata = null, ManagedInstanceDatabaseFormat? databaseFormat = null) + { + tags ??= new Dictionary(); + privateEndpointConnections ??= new List(); + + return new ManagedInstanceData( + id, + name, + resourceType, + systemData, + tags, + location, + identity, + sku, + provisioningState, + managedInstanceCreateMode, + fullyQualifiedDomainName, + isGeneralPurposeV2, + administratorLogin, + administratorLoginPassword, + subnetId, + state, + licenseType, + hybridSecondaryUsage, + hybridSecondaryUsageDetected, + vCores, + storageSizeInGB, + storageIOps, + storageThroughputMBps, + collation, + dnsZone, + managedDnsZonePartner, + isPublicDataEndpointEnabled, + sourceManagedInstanceId, + restorePointInTime, + proxyOverride, + timezoneId, + instancePoolId, + maintenanceConfigurationId, + privateEndpointConnections?.ToList(), + minimalTlsVersion, + currentBackupStorageRedundancy, + requestedBackupStorageRedundancy, + isZoneRedundant, + primaryUserAssignedIdentityId, + keyId, + administrators, + servicePrincipal, + virtualClusterId, + externalGovernanceStatus, + pricingModel, + createOn, + authenticationMetadata, + databaseFormat, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource ID. + /// Private endpoint connection properties. + /// A new instance for mocking. + public static ManagedInstancePecProperty ManagedInstancePecProperty(ResourceIdentifier id = null, ManagedInstancePrivateEndpointConnectionProperties properties = null) + { + return new ManagedInstancePecProperty(id, properties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Azure Active Directory application object id. + /// The Azure Active Directory application client id. + /// The Azure Active Directory tenant id. + /// Service principal type. + /// A new instance for mocking. + public static SqlServicePrincipal SqlServicePrincipal(Guid? principalId = null, Guid? clientId = null, Guid? tenantId = null, SqlServicePrincipalType? principalType = null) + { + return new SqlServicePrincipal(principalId, clientId, tenantId, principalType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Managed instance sku. + /// Managed instance identity. + /// Resource tags. + /// Provisioning state of managed instance. + /// + /// Specifies the mode of database creation. + /// + /// Default: Regular instance creation. + /// + /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. + /// + /// The fully qualified domain name of the managed instance. + /// Whether or not this is a GPv2 variant of General Purpose edition. + /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). + /// The administrator login password (required for managed instance creation). + /// Subnet resource ID for the managed instance. + /// The state of the managed instance. + /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). + /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. + /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage throughput MBps parameter is not supported in the instance create/update operation. + /// Collation of the managed instance. + /// The Dns Zone that the managed instance is in. + /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. + /// Whether or not the public data endpoint is enabled. + /// The resource identifier of the source managed instance associated with create operation of this instance. + /// Specifies the point in time (ISO8601 format) of the source database that will be restored to create the new database. + /// Connection type used for connecting to the instance. + /// + /// Id of the timezone. Allowed values are timezones supported by Windows. + /// Windows keeps details on supported timezones, including the id, in registry under + /// KEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones. + /// You can get those registry values via SQL Server by querying SELECT name AS timezone_id FROM sys.time_zone_info. + /// List of Ids can also be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. + /// An example of valid timezone id is "Pacific Standard Time" or "W. Europe Standard Time". + /// + /// The Id of the instance pool this managed server belongs to. + /// Specifies maintenance configuration id to apply to this managed instance. + /// List of private endpoint connections on a managed instance. + /// Minimal TLS version. Allowed values: 'None', '1.0', '1.1', '1.2'. + /// The storage account type used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// The storage account type to be used to store backups for this instance. The options are Local (LocallyRedundantStorage), Zone (ZoneRedundantStorage), Geo (GeoRedundantStorage) and GeoZone(GeoZoneRedundantStorage). + /// Whether or not the multi-az is enabled. + /// The resource id of a user assigned identity to be used by default. + /// A CMK URI of the key to use for encryption. + /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. + /// The managed instance's service principal. + /// Virtual cluster resource id for the Managed Instance. + /// Status of external governance. + /// Weather or not Managed Instance is freemium. + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + /// The managed instance's authentication metadata lookup mode. + /// Specifies the internal format of instance databases specific to the SQL engine version. + /// A new instance for mocking. + public static ManagedInstancePatch ManagedInstancePatch(SqlSku sku = null, ManagedServiceIdentity identity = null, IDictionary tags = null, JobExecutionProvisioningState? provisioningState = null, ManagedServerCreateMode? managedInstanceCreateMode = null, string fullyQualifiedDomainName = null, bool? isGeneralPurposeV2 = null, string administratorLogin = null, string administratorLoginPassword = null, ResourceIdentifier subnetId = null, string state = null, ManagedInstanceLicenseType? licenseType = null, HybridSecondaryUsage? hybridSecondaryUsage = null, HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = null, int? vCores = null, int? storageSizeInGB = null, int? storageIOps = null, int? storageThroughputMBps = null, string collation = null, string dnsZone = null, ResourceIdentifier managedDnsZonePartner = null, bool? isPublicDataEndpointEnabled = null, ResourceIdentifier sourceManagedInstanceId = null, DateTimeOffset? restorePointInTime = null, ManagedInstanceProxyOverride? proxyOverride = null, string timezoneId = null, ResourceIdentifier instancePoolId = null, ResourceIdentifier maintenanceConfigurationId = null, IEnumerable privateEndpointConnections = null, string minimalTlsVersion = null, SqlBackupStorageRedundancy? currentBackupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isZoneRedundant = null, ResourceIdentifier primaryUserAssignedIdentityId = null, Uri keyId = null, ManagedInstanceExternalAdministrator administrators = null, SqlServicePrincipal servicePrincipal = null, string virtualClusterId = null, ExternalGovernanceStatus? externalGovernanceStatus = null, FreemiumType? pricingModel = null, DateTimeOffset? createOn = null, AuthMetadataLookupMode? authenticationMetadata = null, ManagedInstanceDatabaseFormat? databaseFormat = null) { tags ??= new Dictionary(); + privateEndpointConnections ??= new List(); - return new InstancePoolData( - id, - name, - resourceType, - systemData, - tags, - location, + return new ManagedInstancePatch( sku, + identity, + tags, + provisioningState, + managedInstanceCreateMode, + fullyQualifiedDomainName, + isGeneralPurposeV2, + administratorLogin, + administratorLoginPassword, subnetId, - vCores, + state, licenseType, + hybridSecondaryUsage, + hybridSecondaryUsageDetected, + vCores, + storageSizeInGB, + storageIOps, + storageThroughputMBps, + collation, dnsZone, + managedDnsZonePartner, + isPublicDataEndpointEnabled, + sourceManagedInstanceId, + restorePointInTime, + proxyOverride, + timezoneId, + instancePoolId, maintenanceConfigurationId, + privateEndpointConnections?.ToList(), + minimalTlsVersion, + currentBackupStorageRedundancy, + requestedBackupStorageRedundancy, + isZoneRedundant, + primaryUserAssignedIdentityId, + keyId, + administrators, + servicePrincipal, + virtualClusterId, + externalGovernanceStatus, + pricingModel, + createOn, + authenticationMetadata, + databaseFormat, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The name and tier of the SKU. - /// Resource tags. - /// Resource ID of the subnet to place this instance pool in. - /// Count of vCores belonging to this instance pool. - /// The license type. Possible values are 'LicenseIncluded' (price for SQL license is included) and 'BasePrice' (without SQL license price). - /// The Dns Zone that the managed instance pool is in. - /// Specifies maintenance configuration id to apply to this managed instance. - /// A new instance for mocking. - public static InstancePoolPatch InstancePoolPatch(SqlSku sku = null, IDictionary tags = null, ResourceIdentifier subnetId = null, int? vCores = null, InstancePoolLicenseType? licenseType = null, string dnsZone = null, ResourceIdentifier maintenanceConfigurationId = null) + /// Initializes a new instance of . + /// The type of service accessed by the managed instance service, e.g., Azure Storage, Azure Active Directory, etc. + /// The endpoints that the managed instance service communicates with in order to function correctly. + /// A new instance for mocking. + public static SqlOutboundEnvironmentEndpoint SqlOutboundEnvironmentEndpoint(string category = null, IEnumerable endpoints = null) { - tags ??= new Dictionary(); + endpoints ??= new List(); - return new InstancePoolPatch( - sku, - tags, - subnetId, - vCores, - licenseType, - dnsZone, - maintenanceConfigurationId, - serializedAdditionalRawData: null); + return new SqlOutboundEnvironmentEndpoint(category, endpoints?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The server name that the backup database belong to. - /// The create time of the server. - /// The name of the database the backup belong to. - /// The delete time of the database. - /// The time the backup was taken. - /// The time the long term retention backup will expire. - /// The storage redundancy type of the backup. - /// The storage redundancy type of the backup. - /// The setting whether the LTR backup is immutable. - /// The BackupStorageAccessTier for the LTR backup. - /// A new instance for mocking. - public static LongTermRetentionBackupData LongTermRetentionBackupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string serverName = null, DateTimeOffset? serverCreateOn = null, string databaseName = null, DateTimeOffset? databaseDeletedOn = null, DateTimeOffset? backupOn = null, DateTimeOffset? backupExpireOn = null, SqlBackupStorageRedundancy? backupStorageRedundancy = null, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy = null, bool? isBackupImmutable = null, SqlBackupStorageAccessTier? backupStorageAccessTier = null) + /// Initializes a new instance of . + /// The domain name of the dependency. + /// The IP Addresses and Ports used when connecting to DomainName. + /// A new instance for mocking. + public static ManagedInstanceEndpointDependency ManagedInstanceEndpointDependency(string domainName = null, IEnumerable endpointDetails = null) { - return new LongTermRetentionBackupData( - id, - name, - resourceType, - systemData, - serverName, - serverCreateOn, - databaseName, - databaseDeletedOn, - backupOn, - backupExpireOn, - backupStorageRedundancy, - requestedBackupStorageRedundancy, - isBackupImmutable, - backupStorageAccessTier, - serializedAdditionalRawData: null); + endpointDetails ??= new List(); + + return new ManagedInstanceEndpointDependency(domainName, endpointDetails?.ToList(), serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The port an endpoint is connected to. + /// A new instance for mocking. + public static ManagedInstanceEndpointDetail ManagedInstanceEndpointDetail(int? port = null) + { + return new ManagedInstanceEndpointDetail(port, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. /// Request Id. - /// Operation type. - /// Source backup resource id. - /// Target backup resource id. - /// The storage redundancy type of the copied backup. + /// Request type. + /// Queued time. + /// Managed instance name. /// Operation status. - /// Progress message. - /// A new instance for mocking. - public static LongTermRetentionBackupOperationResult LongTermRetentionBackupOperationResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? requestId = null, string operationType = null, ResourceIdentifier fromBackupResourceId = null, ResourceIdentifier toBackupResourceId = null, SqlBackupStorageRedundancy? targetBackupStorageRedundancy = null, string status = null, string message = null) + /// Error message. + /// A new instance for mocking. + public static RefreshExternalGovernanceStatusOperationResultMI RefreshExternalGovernanceStatusOperationResultMI(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, Guid? requestId = null, string requestType = null, string queuedTime = null, string managedInstanceName = null, string status = null, string errorMessage = null) { - return new LongTermRetentionBackupOperationResult( + return new RefreshExternalGovernanceStatusOperationResultMI( id, name, resourceType, systemData, requestId, - operationType, - fromBackupResourceId, - toBackupResourceId, - targetBackupStorageRedundancy, + requestType, + queuedTime, + managedInstanceName, status, - message, + errorMessage, serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The setting whether to make LTR backups immutable. - /// The BackupStorageAccessTier for the LTR backups. - /// The weekly retention policy for an LTR backup in an ISO 8601 format. - /// The monthly retention policy for an LTR backup in an ISO 8601 format. - /// The yearly retention policy for an LTR backup in an ISO 8601 format. - /// The week of year to take the yearly backup in an ISO 8601 format. - /// A new instance for mocking. - public static LongTermRetentionPolicyData LongTermRetentionPolicyData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? makeBackupsImmutable = null, SqlBackupStorageAccessTier? backupStorageAccessTier = null, string weeklyRetention = null, string monthlyRetention = null, string yearlyRetention = null, int? weekOfYear = null) + /// Initializes a new instance of . + /// Requested number of top queries. + /// Aggregation function used to calculate query metrics. + /// Metric used to rank queries. + /// Interval type (length). + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// List of top resource consuming queries with appropriate metric data. + /// A new instance for mocking. + public static TopQueries TopQueries(int? numberOfQueries = null, string aggregationFunction = null, string observationMetric = null, QueryTimeGrainType? intervalType = null, string startTime = null, string endTime = null, IEnumerable queries = null) { - return new LongTermRetentionPolicyData( - id, - name, - resourceType, - systemData, - makeBackupsImmutable, - backupStorageAccessTier, - weeklyRetention, - monthlyRetention, - yearlyRetention, - weekOfYear, + queries ??= new List(); + + return new TopQueries( + numberOfQueries, + aggregationFunction, + observationMetric, + intervalType, + startTime, + endTime, + queries?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Database name of the database in which this query was executed. + /// Unique query id (unique within one database). + /// The start time for the metric (ISO-8601 format). + /// The end time for the metric (ISO-8601 format). + /// List of intervals with appropriate metric data. + /// A new instance for mocking. + public static QueryStatisticsProperties QueryStatisticsProperties(string databaseName = null, string queryId = null, string startTime = null, string endTime = null, IEnumerable intervals = null) + { + intervals ??= new List(); + + return new QueryStatisticsProperties( + databaseName, + queryId, + startTime, + endTime, + intervals?.ToList(), serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The start time for the metric interval (ISO-8601 format). + /// Interval type (length). + /// Execution count of a query in this interval. + /// List of metric objects for this interval. + /// A new instance for mocking. + public static QueryMetricIntervalAutoGenerated QueryMetricIntervalAutoGenerated(string intervalStartTime = null, QueryTimeGrainType? intervalType = null, long? executionCount = null, IEnumerable metrics = null) + { + metrics ??= new List(); + + return new QueryMetricIntervalAutoGenerated(intervalStartTime, intervalType, executionCount, metrics?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// /// @@ -6156,5 +6205,104 @@ public static SqlServerDatabaseReplicationLinkPatch SqlServerDatabaseReplication linkType, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Name of the distributed availability group. + /// ID of the distributed availability group. + /// Replication mode of the link. + /// SQL server side link role. + /// SQL server side availability group name. + /// SQL server side endpoint - IP or DNS resolvable name. + /// Managed instance side link role. + /// Managed instance side availability group name. + /// The link failover mode - can be Manual if intended to be used for two-way failover with a supported SQL Server, or None for one-way failover to Azure. + /// Database seeding mode – can be Automatic (default), or Manual for supported scenarios. + /// Databases in the distributed availability group. + /// A new instance for mocking. + public static DistributedAvailabilityGroupData DistributedAvailabilityGroupData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string distributedAvailabilityGroupName = null, Guid? distributedAvailabilityGroupId = null, ReplicationModeType? replicationMode = null, LinkRole? partnerLinkRole = null, string partnerAvailabilityGroupName = null, string partnerEndpoint = null, LinkRole? instanceLinkRole = null, string instanceAvailabilityGroupName = null, FailoverModeType? failoverMode = null, SeedingModeType? seedingMode = null, IEnumerable databases = null) + { + databases ??= new List(); + + return new DistributedAvailabilityGroupData( + id, + name, + resourceType, + systemData, + distributedAvailabilityGroupName, + distributedAvailabilityGroupId, + replicationMode, + partnerLinkRole, + partnerAvailabilityGroupName, + partnerEndpoint, + instanceLinkRole, + instanceAvailabilityGroupName, + failoverMode, + seedingMode, + databases?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the database in link. + /// Managed instance replica id. + /// SQL server replica id. + /// Current link state. + /// Seeding progress. + /// Link health state. + /// Link connected state. + /// Last received LSN. + /// Last received LSN time. + /// Last sent LSN. + /// Last sent LSN time. + /// Last commit LSN. + /// Last commit LSN time. + /// Last hardened LSN. + /// Last hardened LSN time. + /// Last backup LSN. + /// Last backup LSN time. + /// The most recent link connection error description. + /// SQL server certificate validity. + /// Replication lag when Managed Instance link side is primary. + /// Redo lag when Managed Instance link side is primary. + /// A new instance for mocking. + public static DistributedAvailabilityGroupDatabase DistributedAvailabilityGroupDatabase(string databaseName = null, Guid? instanceReplicaId = null, Guid? partnerReplicaId = null, string replicaState = null, string seedingProgress = null, ReplicaSynchronizationHealth? synchronizationHealth = null, ReplicaConnectedState? connectedState = null, string lastReceivedLsn = null, DateTimeOffset? lastReceivedOn = null, string lastSentLsn = null, DateTimeOffset? lastSentOn = null, string lastCommitLsn = null, DateTimeOffset? lastCommitOn = null, string lastHardenedLsn = null, DateTimeOffset? lastHardenedOn = null, string lastBackupLsn = null, DateTimeOffset? lastBackupOn = null, string mostRecentLinkError = null, CertificateInfo partnerAuthCertValidity = null, int? instanceSendReplicationLagSeconds = null, int? instanceRedoReplicationLagSeconds = null) + { + return new DistributedAvailabilityGroupDatabase( + databaseName, + instanceReplicaId, + partnerReplicaId, + replicaState, + seedingProgress, + synchronizationHealth, + connectedState, + lastReceivedLsn, + lastReceivedOn, + lastSentLsn, + lastSentOn, + lastCommitLsn, + lastCommitOn, + lastHardenedLsn, + lastHardenedOn, + lastBackupLsn, + lastBackupOn, + mostRecentLinkError, + partnerAuthCertValidity, + instanceSendReplicationLagSeconds, + instanceRedoReplicationLagSeconds, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The certificate name. + /// The certificate expiry date. + /// A new instance for mocking. + public static CertificateInfo CertificateInfo(string certificateName = null, DateTimeOffset? expiryOn = null) + { + return new CertificateInfo(certificateName, expiryOn, serializedAdditionalRawData: null); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs index aa5cc50bc01c..3f22631d00ff 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Cr /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string distrib /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(C /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Cancellatio /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string distributedAvailabi /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string distributedAvailabilityGroupName, Ca /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.Serialization.cs index 8a4a3be67311..b006c12af402 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; using System.Text; using System.Text.Json; using Azure.Core; @@ -40,55 +41,65 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri base.JsonModelWriteCore(writer, options); writer.WritePropertyName("properties"u8); writer.WriteStartObject(); - if (Optional.IsDefined(TargetDatabase)) + if (options.Format != "W" && Optional.IsDefined(DistributedAvailabilityGroupName)) { - writer.WritePropertyName("targetDatabase"u8); - writer.WriteStringValue(TargetDatabase); + writer.WritePropertyName("distributedAvailabilityGroupName"u8); + writer.WriteStringValue(DistributedAvailabilityGroupName); } - if (Optional.IsDefined(SourceEndpoint)) + if (options.Format != "W" && Optional.IsDefined(DistributedAvailabilityGroupId)) { - writer.WritePropertyName("sourceEndpoint"u8); - writer.WriteStringValue(SourceEndpoint); + writer.WritePropertyName("distributedAvailabilityGroupId"u8); + writer.WriteStringValue(DistributedAvailabilityGroupId.Value); } - if (Optional.IsDefined(PrimaryAvailabilityGroupName)) + if (Optional.IsDefined(ReplicationMode)) { - writer.WritePropertyName("primaryAvailabilityGroupName"u8); - writer.WriteStringValue(PrimaryAvailabilityGroupName); + writer.WritePropertyName("replicationMode"u8); + writer.WriteStringValue(ReplicationMode.Value.ToString()); } - if (Optional.IsDefined(SecondaryAvailabilityGroupName)) + if (options.Format != "W" && Optional.IsDefined(PartnerLinkRole)) { - writer.WritePropertyName("secondaryAvailabilityGroupName"u8); - writer.WriteStringValue(SecondaryAvailabilityGroupName); + writer.WritePropertyName("partnerLinkRole"u8); + writer.WriteStringValue(PartnerLinkRole.Value.ToString()); } - if (Optional.IsDefined(ReplicationMode)) + if (Optional.IsDefined(PartnerAvailabilityGroupName)) { - writer.WritePropertyName("replicationMode"u8); - writer.WriteStringValue(ReplicationMode.Value.ToString()); + writer.WritePropertyName("partnerAvailabilityGroupName"u8); + writer.WriteStringValue(PartnerAvailabilityGroupName); } - if (options.Format != "W" && Optional.IsDefined(DistributedAvailabilityGroupId)) + if (Optional.IsDefined(PartnerEndpoint)) { - writer.WritePropertyName("distributedAvailabilityGroupId"u8); - writer.WriteStringValue(DistributedAvailabilityGroupId.Value); + writer.WritePropertyName("partnerEndpoint"u8); + writer.WriteStringValue(PartnerEndpoint); } - if (options.Format != "W" && Optional.IsDefined(SourceReplicaId)) + if (Optional.IsDefined(InstanceLinkRole)) { - writer.WritePropertyName("sourceReplicaId"u8); - writer.WriteStringValue(SourceReplicaId.Value); + writer.WritePropertyName("instanceLinkRole"u8); + writer.WriteStringValue(InstanceLinkRole.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(TargetReplicaId)) + if (Optional.IsDefined(InstanceAvailabilityGroupName)) { - writer.WritePropertyName("targetReplicaId"u8); - writer.WriteStringValue(TargetReplicaId.Value); + writer.WritePropertyName("instanceAvailabilityGroupName"u8); + writer.WriteStringValue(InstanceAvailabilityGroupName); } - if (options.Format != "W" && Optional.IsDefined(LinkState)) + if (Optional.IsDefined(FailoverMode)) { - writer.WritePropertyName("linkState"u8); - writer.WriteStringValue(LinkState); + writer.WritePropertyName("failoverMode"u8); + writer.WriteStringValue(FailoverMode.Value.ToString()); } - if (options.Format != "W" && Optional.IsDefined(LastHardenedLsn)) + if (Optional.IsDefined(SeedingMode)) { - writer.WritePropertyName("lastHardenedLsn"u8); - writer.WriteStringValue(LastHardenedLsn); + writer.WritePropertyName("seedingMode"u8); + writer.WriteStringValue(SeedingMode.Value.ToString()); + } + if (Optional.IsCollectionDefined(Databases)) + { + writer.WritePropertyName("databases"u8); + writer.WriteStartArray(); + foreach (var item in Databases) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); } writer.WriteEndObject(); } @@ -117,16 +128,17 @@ internal static DistributedAvailabilityGroupData DeserializeDistributedAvailabil string name = default; ResourceType type = default; SystemData systemData = default; - string targetDatabase = default; - string sourceEndpoint = default; - string primaryAvailabilityGroupName = default; - string secondaryAvailabilityGroupName = default; - DistributedAvailabilityGroupReplicationMode? replicationMode = default; + string distributedAvailabilityGroupName = default; Guid? distributedAvailabilityGroupId = default; - Guid? sourceReplicaId = default; - Guid? targetReplicaId = default; - string linkState = default; - string lastHardenedLsn = default; + ReplicationModeType? replicationMode = default; + LinkRole? partnerLinkRole = default; + string partnerAvailabilityGroupName = default; + string partnerEndpoint = default; + LinkRole? instanceLinkRole = default; + string instanceAvailabilityGroupName = default; + FailoverModeType? failoverMode = default; + SeedingModeType? seedingMode = default; + IList databases = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -164,24 +176,18 @@ internal static DistributedAvailabilityGroupData DeserializeDistributedAvailabil } foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.NameEquals("targetDatabase"u8)) - { - targetDatabase = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("sourceEndpoint"u8)) + if (property0.NameEquals("distributedAvailabilityGroupName"u8)) { - sourceEndpoint = property0.Value.GetString(); + distributedAvailabilityGroupName = property0.Value.GetString(); continue; } - if (property0.NameEquals("primaryAvailabilityGroupName"u8)) - { - primaryAvailabilityGroupName = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("secondaryAvailabilityGroupName"u8)) + if (property0.NameEquals("distributedAvailabilityGroupId"u8)) { - secondaryAvailabilityGroupName = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + distributedAvailabilityGroupId = property0.Value.GetGuid(); continue; } if (property0.NameEquals("replicationMode"u8)) @@ -190,44 +196,72 @@ internal static DistributedAvailabilityGroupData DeserializeDistributedAvailabil { continue; } - replicationMode = new DistributedAvailabilityGroupReplicationMode(property0.Value.GetString()); + replicationMode = new ReplicationModeType(property0.Value.GetString()); continue; } - if (property0.NameEquals("distributedAvailabilityGroupId"u8)) + if (property0.NameEquals("partnerLinkRole"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - distributedAvailabilityGroupId = property0.Value.GetGuid(); + partnerLinkRole = new LinkRole(property0.Value.GetString()); continue; } - if (property0.NameEquals("sourceReplicaId"u8)) + if (property0.NameEquals("partnerAvailabilityGroupName"u8)) + { + partnerAvailabilityGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("partnerEndpoint"u8)) + { + partnerEndpoint = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("instanceLinkRole"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - sourceReplicaId = property0.Value.GetGuid(); + instanceLinkRole = new LinkRole(property0.Value.GetString()); continue; } - if (property0.NameEquals("targetReplicaId"u8)) + if (property0.NameEquals("instanceAvailabilityGroupName"u8)) + { + instanceAvailabilityGroupName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("failoverMode"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) { continue; } - targetReplicaId = property0.Value.GetGuid(); + failoverMode = new FailoverModeType(property0.Value.GetString()); continue; } - if (property0.NameEquals("linkState"u8)) + if (property0.NameEquals("seedingMode"u8)) { - linkState = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + seedingMode = new SeedingModeType(property0.Value.GetString()); continue; } - if (property0.NameEquals("lastHardenedLsn"u8)) + if (property0.NameEquals("databases"u8)) { - lastHardenedLsn = property0.Value.GetString(); + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DistributedAvailabilityGroupDatabase.DeserializeDistributedAvailabilityGroupDatabase(item, options)); + } + databases = array; continue; } } @@ -244,16 +278,17 @@ internal static DistributedAvailabilityGroupData DeserializeDistributedAvailabil name, type, systemData, - targetDatabase, - sourceEndpoint, - primaryAvailabilityGroupName, - secondaryAvailabilityGroupName, - replicationMode, + distributedAvailabilityGroupName, distributedAvailabilityGroupId, - sourceReplicaId, - targetReplicaId, - linkState, - lastHardenedLsn, + replicationMode, + partnerLinkRole, + partnerAvailabilityGroupName, + partnerEndpoint, + instanceLinkRole, + instanceAvailabilityGroupName, + failoverMode, + seedingMode, + databases ?? new ChangeTrackingList(), serializedAdditionalRawData); } @@ -323,200 +358,207 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.Append(" properties:"); builder.AppendLine(" {"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TargetDatabase), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DistributedAvailabilityGroupName), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" targetDatabase: "); + builder.Append(" distributedAvailabilityGroupName: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(TargetDatabase)) + if (Optional.IsDefined(DistributedAvailabilityGroupName)) { - builder.Append(" targetDatabase: "); - if (TargetDatabase.Contains(Environment.NewLine)) + builder.Append(" distributedAvailabilityGroupName: "); + if (DistributedAvailabilityGroupName.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{TargetDatabase}'''"); + builder.AppendLine($"{DistributedAvailabilityGroupName}'''"); } else { - builder.AppendLine($"'{TargetDatabase}'"); + builder.AppendLine($"'{DistributedAvailabilityGroupName}'"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceEndpoint), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DistributedAvailabilityGroupId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" sourceEndpoint: "); + builder.Append(" distributedAvailabilityGroupId: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SourceEndpoint)) + if (Optional.IsDefined(DistributedAvailabilityGroupId)) { - builder.Append(" sourceEndpoint: "); - if (SourceEndpoint.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{SourceEndpoint}'''"); - } - else - { - builder.AppendLine($"'{SourceEndpoint}'"); - } + builder.Append(" distributedAvailabilityGroupId: "); + builder.AppendLine($"'{DistributedAvailabilityGroupId.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PrimaryAvailabilityGroupName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicationMode), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" primaryAvailabilityGroupName: "); + builder.Append(" replicationMode: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(PrimaryAvailabilityGroupName)) + if (Optional.IsDefined(ReplicationMode)) { - builder.Append(" primaryAvailabilityGroupName: "); - if (PrimaryAvailabilityGroupName.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{PrimaryAvailabilityGroupName}'''"); - } - else - { - builder.AppendLine($"'{PrimaryAvailabilityGroupName}'"); - } + builder.Append(" replicationMode: "); + builder.AppendLine($"'{ReplicationMode.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecondaryAvailabilityGroupName), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerLinkRole), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" secondaryAvailabilityGroupName: "); + builder.Append(" partnerLinkRole: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SecondaryAvailabilityGroupName)) + if (Optional.IsDefined(PartnerLinkRole)) { - builder.Append(" secondaryAvailabilityGroupName: "); - if (SecondaryAvailabilityGroupName.Contains(Environment.NewLine)) + builder.Append(" partnerLinkRole: "); + builder.AppendLine($"'{PartnerLinkRole.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerAvailabilityGroupName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" partnerAvailabilityGroupName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PartnerAvailabilityGroupName)) + { + builder.Append(" partnerAvailabilityGroupName: "); + if (PartnerAvailabilityGroupName.Contains(Environment.NewLine)) { builder.AppendLine("'''"); - builder.AppendLine($"{SecondaryAvailabilityGroupName}'''"); + builder.AppendLine($"{PartnerAvailabilityGroupName}'''"); } else { - builder.AppendLine($"'{SecondaryAvailabilityGroupName}'"); + builder.AppendLine($"'{PartnerAvailabilityGroupName}'"); } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicationMode), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerEndpoint), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" replicationMode: "); + builder.Append(" partnerEndpoint: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(ReplicationMode)) + if (Optional.IsDefined(PartnerEndpoint)) { - builder.Append(" replicationMode: "); - builder.AppendLine($"'{ReplicationMode.Value.ToString()}'"); + builder.Append(" partnerEndpoint: "); + if (PartnerEndpoint.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PartnerEndpoint}'''"); + } + else + { + builder.AppendLine($"'{PartnerEndpoint}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DistributedAvailabilityGroupId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceLinkRole), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" distributedAvailabilityGroupId: "); + builder.Append(" instanceLinkRole: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(DistributedAvailabilityGroupId)) + if (Optional.IsDefined(InstanceLinkRole)) { - builder.Append(" distributedAvailabilityGroupId: "); - builder.AppendLine($"'{DistributedAvailabilityGroupId.Value.ToString()}'"); + builder.Append(" instanceLinkRole: "); + builder.AppendLine($"'{InstanceLinkRole.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SourceReplicaId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceAvailabilityGroupName), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" sourceReplicaId: "); + builder.Append(" instanceAvailabilityGroupName: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(SourceReplicaId)) + if (Optional.IsDefined(InstanceAvailabilityGroupName)) { - builder.Append(" sourceReplicaId: "); - builder.AppendLine($"'{SourceReplicaId.Value.ToString()}'"); + builder.Append(" instanceAvailabilityGroupName: "); + if (InstanceAvailabilityGroupName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{InstanceAvailabilityGroupName}'''"); + } + else + { + builder.AppendLine($"'{InstanceAvailabilityGroupName}'"); + } } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TargetReplicaId), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FailoverMode), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" targetReplicaId: "); + builder.Append(" failoverMode: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(TargetReplicaId)) + if (Optional.IsDefined(FailoverMode)) { - builder.Append(" targetReplicaId: "); - builder.AppendLine($"'{TargetReplicaId.Value.ToString()}'"); + builder.Append(" failoverMode: "); + builder.AppendLine($"'{FailoverMode.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkState), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SeedingMode), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" linkState: "); + builder.Append(" seedingMode: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(LinkState)) + if (Optional.IsDefined(SeedingMode)) { - builder.Append(" linkState: "); - if (LinkState.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{LinkState}'''"); - } - else - { - builder.AppendLine($"'{LinkState}'"); - } + builder.Append(" seedingMode: "); + builder.AppendLine($"'{SeedingMode.Value.ToString()}'"); } } - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastHardenedLsn), out propertyOverride); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Databases), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" lastHardenedLsn: "); + builder.Append(" databases: "); builder.AppendLine(propertyOverride); } else { - if (Optional.IsDefined(LastHardenedLsn)) + if (Optional.IsCollectionDefined(Databases)) { - builder.Append(" lastHardenedLsn: "); - if (LastHardenedLsn.Contains(Environment.NewLine)) + if (Databases.Any()) { - builder.AppendLine("'''"); - builder.AppendLine($"{LastHardenedLsn}'''"); - } - else - { - builder.AppendLine($"'{LastHardenedLsn}'"); + builder.Append(" databases: "); + builder.AppendLine("["); + foreach (var item in Databases) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " databases: "); + } + builder.AppendLine(" ]"); } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs index a47b5c99fdb0..d6d9aac83086 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupData.cs @@ -54,6 +54,7 @@ public partial class DistributedAvailabilityGroupData : ResourceData /// Initializes a new instance of . public DistributedAvailabilityGroupData() { + Databases = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -61,61 +62,66 @@ public DistributedAvailabilityGroupData() /// The name. /// The resourceType. /// The systemData. - /// The name of the target database. - /// The source endpoint. - /// The primary availability group name. - /// The secondary availability group name. - /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. - /// The distributed availability group id. - /// The source replica id. - /// The target replica id. - /// The link state. - /// The last hardened lsn. + /// Name of the distributed availability group. + /// ID of the distributed availability group. + /// Replication mode of the link. + /// SQL server side link role. + /// SQL server side availability group name. + /// SQL server side endpoint - IP or DNS resolvable name. + /// Managed instance side link role. + /// Managed instance side availability group name. + /// The link failover mode - can be Manual if intended to be used for two-way failover with a supported SQL Server, or None for one-way failover to Azure. + /// Database seeding mode – can be Automatic (default), or Manual for supported scenarios. + /// Databases in the distributed availability group. /// Keeps track of any properties unknown to the library. - internal DistributedAvailabilityGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string targetDatabase, string sourceEndpoint, string primaryAvailabilityGroupName, string secondaryAvailabilityGroupName, DistributedAvailabilityGroupReplicationMode? replicationMode, Guid? distributedAvailabilityGroupId, Guid? sourceReplicaId, Guid? targetReplicaId, string linkState, string lastHardenedLsn, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal DistributedAvailabilityGroupData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string distributedAvailabilityGroupName, Guid? distributedAvailabilityGroupId, ReplicationModeType? replicationMode, LinkRole? partnerLinkRole, string partnerAvailabilityGroupName, string partnerEndpoint, LinkRole? instanceLinkRole, string instanceAvailabilityGroupName, FailoverModeType? failoverMode, SeedingModeType? seedingMode, IList databases, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - TargetDatabase = targetDatabase; - SourceEndpoint = sourceEndpoint; - PrimaryAvailabilityGroupName = primaryAvailabilityGroupName; - SecondaryAvailabilityGroupName = secondaryAvailabilityGroupName; - ReplicationMode = replicationMode; + DistributedAvailabilityGroupName = distributedAvailabilityGroupName; DistributedAvailabilityGroupId = distributedAvailabilityGroupId; - SourceReplicaId = sourceReplicaId; - TargetReplicaId = targetReplicaId; - LinkState = linkState; - LastHardenedLsn = lastHardenedLsn; + ReplicationMode = replicationMode; + PartnerLinkRole = partnerLinkRole; + PartnerAvailabilityGroupName = partnerAvailabilityGroupName; + PartnerEndpoint = partnerEndpoint; + InstanceLinkRole = instanceLinkRole; + InstanceAvailabilityGroupName = instanceAvailabilityGroupName; + FailoverMode = failoverMode; + SeedingMode = seedingMode; + Databases = databases; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The name of the target database. - [WirePath("properties.targetDatabase")] - public string TargetDatabase { get; set; } - /// The source endpoint. - [WirePath("properties.sourceEndpoint")] - public string SourceEndpoint { get; set; } - /// The primary availability group name. - [WirePath("properties.primaryAvailabilityGroupName")] - public string PrimaryAvailabilityGroupName { get; set; } - /// The secondary availability group name. - [WirePath("properties.secondaryAvailabilityGroupName")] - public string SecondaryAvailabilityGroupName { get; set; } - /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. - [WirePath("properties.replicationMode")] - public DistributedAvailabilityGroupReplicationMode? ReplicationMode { get; set; } - /// The distributed availability group id. + /// Name of the distributed availability group. + [WirePath("properties.distributedAvailabilityGroupName")] + public string DistributedAvailabilityGroupName { get; } + /// ID of the distributed availability group. [WirePath("properties.distributedAvailabilityGroupId")] public Guid? DistributedAvailabilityGroupId { get; } - /// The source replica id. - [WirePath("properties.sourceReplicaId")] - public Guid? SourceReplicaId { get; } - /// The target replica id. - [WirePath("properties.targetReplicaId")] - public Guid? TargetReplicaId { get; } - /// The link state. - [WirePath("properties.linkState")] - public string LinkState { get; } - /// The last hardened lsn. - [WirePath("properties.lastHardenedLsn")] - public string LastHardenedLsn { get; } + /// Replication mode of the link. + [WirePath("properties.replicationMode")] + public ReplicationModeType? ReplicationMode { get; set; } + /// SQL server side link role. + [WirePath("properties.partnerLinkRole")] + public LinkRole? PartnerLinkRole { get; } + /// SQL server side availability group name. + [WirePath("properties.partnerAvailabilityGroupName")] + public string PartnerAvailabilityGroupName { get; set; } + /// SQL server side endpoint - IP or DNS resolvable name. + [WirePath("properties.partnerEndpoint")] + public string PartnerEndpoint { get; set; } + /// Managed instance side link role. + [WirePath("properties.instanceLinkRole")] + public LinkRole? InstanceLinkRole { get; set; } + /// Managed instance side availability group name. + [WirePath("properties.instanceAvailabilityGroupName")] + public string InstanceAvailabilityGroupName { get; set; } + /// The link failover mode - can be Manual if intended to be used for two-way failover with a supported SQL Server, or None for one-way failover to Azure. + [WirePath("properties.failoverMode")] + public FailoverModeType? FailoverMode { get; set; } + /// Database seeding mode – can be Automatic (default), or Manual for supported scenarios. + [WirePath("properties.seedingMode")] + public SeedingModeType? SeedingMode { get; set; } + /// Databases in the distributed availability group. + [WirePath("properties.databases")] + public IList Databases { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs index a78cb3205da7..6a6bedd309ce 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/DistributedAvailabilityGroupResource.cs @@ -11,6 +11,7 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; +using Azure.ResourceManager.Sql.Models; namespace Azure.ResourceManager.Sql { @@ -101,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -141,7 +142,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -181,7 +182,7 @@ public virtual Response Get(CancellationTo /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -223,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -265,7 +266,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -311,7 +312,7 @@ public virtual async Task> Up /// /// /// Default Api Version - /// 2021-11-01-preview + /// 2023-08-01-preview /// /// /// Resource @@ -343,5 +344,189 @@ public virtual ArmOperation Update(WaitUnt throw; } } + + /// + /// Performs requested failover type in this distributed availability group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/failover + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Failover + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group failover request parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> FailoverAsync(WaitUntil waitUntil, DistributedAvailabilityGroupsFailoverContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Failover"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.FailoverAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Performs requested failover type in this distributed availability group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/failover + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Failover + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group failover request parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Failover(WaitUntil waitUntil, DistributedAvailabilityGroupsFailoverContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.Failover"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.Failover(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content, cancellationToken); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateFailoverRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Sets the role for managed instance in a distributed availability group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/setRole + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_SetRole + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group set role request parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetRoleAsync(WaitUntil waitUntil, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(distributedAvailabilityGroupSetRole, nameof(distributedAvailabilityGroupSetRole)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.SetRole"); + scope.Start(); + try + { + var response = await _distributedAvailabilityGroupRestClient.SetRoleAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, distributedAvailabilityGroupSetRole, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateSetRoleRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, distributedAvailabilityGroupSetRole).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Sets the role for managed instance in a distributed availability group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName}/setRole + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_SetRole + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The distributed availability group set role request parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation SetRole(WaitUntil waitUntil, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(distributedAvailabilityGroupSetRole, nameof(distributedAvailabilityGroupSetRole)); + + using var scope = _distributedAvailabilityGroupClientDiagnostics.CreateScope("DistributedAvailabilityGroupResource.SetRole"); + scope.Start(); + try + { + var response = _distributedAvailabilityGroupRestClient.SetRole(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, distributedAvailabilityGroupSetRole, cancellationToken); + var operation = new SqlArmOperation(new DistributedAvailabilityGroupOperationSource(Client), _distributedAvailabilityGroupClientDiagnostics, Pipeline, _distributedAvailabilityGroupRestClient.CreateSetRoleRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, distributedAvailabilityGroupSetRole).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs index 217cbffe79ea..7997d4d5f45f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlArmClient.cs @@ -994,18 +994,6 @@ public virtual SqlServerConnectionPolicyResource GetSqlServerConnectionPolicyRes return new SqlServerConnectionPolicyResource(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 DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(ResourceIdentifier id) - { - DistributedAvailabilityGroupResource.ValidateResourceId(id); - return new DistributedAvailabilityGroupResource(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. @@ -1246,18 +1234,6 @@ public virtual ManagedDatabaseResource GetManagedDatabaseResource(ResourceIdenti return new ManagedDatabaseResource(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 ManagedInstanceResource GetManagedInstanceResource(ResourceIdentifier id) - { - ManagedInstanceResource.ValidateResourceId(id); - return new ManagedInstanceResource(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. @@ -1522,6 +1498,18 @@ public virtual LongTermRetentionPolicyResource GetLongTermRetentionPolicyResourc return new LongTermRetentionPolicyResource(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 ManagedInstanceResource GetManagedInstanceResource(ResourceIdentifier id) + { + ManagedInstanceResource.ValidateResourceId(id); + return new ManagedInstanceResource(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. @@ -1545,5 +1533,17 @@ public virtual SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseRepl SqlServerDatabaseReplicationLinkResource.ValidateResourceId(id); return new SqlServerDatabaseReplicationLinkResource(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 DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(ResourceIdentifier id) + { + DistributedAvailabilityGroupResource.ValidateResourceId(id); + return new DistributedAvailabilityGroupResource(Client, id); + } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs index 6e9a0e821e52..e02362bd2516 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlResourceGroupResource.cs @@ -339,77 +339,6 @@ public virtual Response GetInstanceFailoverGroup( return GetInstanceFailoverGroups(locationName).Get(failoverGroupName, cancellationToken); } - /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. - /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. - public virtual ManagedInstanceCollection GetManagedInstances() - { - return GetCachedClient(client => new ManagedInstanceCollection(client, Id)); - } - - /// - /// Gets a managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// - /// - /// Operation Id - /// ManagedInstances_Get - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the managed instance. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetManagedInstanceAsync(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) - { - return await GetManagedInstances().GetAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a managed instance. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} - /// - /// - /// Operation Id - /// ManagedInstances_Get - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The name of the managed instance. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetManagedInstance(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) - { - return GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); - } - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. public virtual InstancePoolCollection GetInstancePools() @@ -559,6 +488,77 @@ public virtual Response GetResourc return GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName).Get(backupName, cancellationToken); } + /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. + /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. + public virtual ManagedInstanceCollection GetManagedInstances() + { + return GetCachedClient(client => new ManagedInstanceCollection(client, Id)); + } + + /// + /// Gets a managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetManagedInstanceAsync(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + return await GetManagedInstances().GetAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a managed instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// + /// + /// Operation Id + /// ManagedInstances_Get + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the managed instance. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetManagedInstance(string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + { + return GetManagedInstances().Get(managedInstanceName, expand, cancellationToken); + } + /// Gets a collection of SqlServerResources in the ResourceGroupResource. /// An object representing collection of SqlServerResources and their operations over a SqlServerResource. public virtual SqlServerCollection GetSqlServers() diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs index b7021143a99e..2ddb2d978f02 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/MockableSqlSubscriptionResource.cs @@ -30,12 +30,12 @@ public partial class MockableSqlSubscriptionResource : ArmResource private LongTermRetentionManagedInstanceBackupsRestOperations _longTermRetentionManagedInstanceBackupsRestClient; private ClientDiagnostics _virtualClusterClientDiagnostics; private VirtualClustersRestOperations _virtualClusterRestClient; - private ClientDiagnostics _managedInstanceClientDiagnostics; - private ManagedInstancesRestOperations _managedInstanceRestClient; private ClientDiagnostics _instancePoolClientDiagnostics; private InstancePoolsRestOperations _instancePoolRestClient; private ClientDiagnostics _longTermRetentionBackupsClientDiagnostics; private LongTermRetentionBackupsRestOperations _longTermRetentionBackupsRestClient; + private ClientDiagnostics _managedInstanceClientDiagnostics; + private ManagedInstancesRestOperations _managedInstanceRestClient; private ClientDiagnostics _sqlServerServersClientDiagnostics; private ServersRestOperations _sqlServerServersRestClient; @@ -61,12 +61,12 @@ internal MockableSqlSubscriptionResource(ArmClient client, ResourceIdentifier id private LongTermRetentionManagedInstanceBackupsRestOperations LongTermRetentionManagedInstanceBackupsRestClient => _longTermRetentionManagedInstanceBackupsRestClient ??= new LongTermRetentionManagedInstanceBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics VirtualClusterClientDiagnostics => _virtualClusterClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", VirtualClusterResource.ResourceType.Namespace, Diagnostics); private VirtualClustersRestOperations VirtualClusterRestClient => _virtualClusterRestClient ??= new VirtualClustersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(VirtualClusterResource.ResourceType)); - private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); - private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); private ClientDiagnostics InstancePoolClientDiagnostics => _instancePoolClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", InstancePoolResource.ResourceType.Namespace, Diagnostics); private InstancePoolsRestOperations InstancePoolRestClient => _instancePoolRestClient ??= new InstancePoolsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstancePoolResource.ResourceType)); private ClientDiagnostics LongTermRetentionBackupsClientDiagnostics => _longTermRetentionBackupsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ProviderConstants.DefaultProviderNamespace, Diagnostics); private LongTermRetentionBackupsRestOperations LongTermRetentionBackupsRestClient => _longTermRetentionBackupsRestClient ??= new LongTermRetentionBackupsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics ManagedInstanceClientDiagnostics => _managedInstanceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", ManagedInstanceResource.ResourceType.Namespace, Diagnostics); + private ManagedInstancesRestOperations ManagedInstanceRestClient => _managedInstanceRestClient ??= new ManagedInstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedInstanceResource.ResourceType)); private ClientDiagnostics SqlServerServersClientDiagnostics => _sqlServerServersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Sql", SqlServerResource.ResourceType.Namespace, Diagnostics); private ServersRestOperations SqlServerServersRestClient => _sqlServerServersRestClient ??= new ServersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SqlServerResource.ResourceType)); @@ -832,68 +832,6 @@ public virtual Pageable GetVirtualClusters(CancellationT return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new VirtualClusterResource(Client, VirtualClusterData.DeserializeVirtualClusterData(e)), VirtualClusterClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetVirtualClusters", "value", "nextLink", cancellationToken); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The child resources to include in the response. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); - } - /// /// Gets a list of all instance pools in the subscription. /// @@ -1080,6 +1018,68 @@ public virtual Pageable GetLongTermRetentionBackups return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => LongTermRetentionBackupData.DeserializeLongTermRetentionBackupData(e), LongTermRetentionBackupsClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetLongTermRetentionBackupsWithServer", "value", "nextLink", cancellationToken); } + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedInstancesAsync(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The child resources to include in the response. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedInstances(string expand = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedInstanceRestClient.CreateListRequest(Id.SubscriptionId, expand); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedInstanceRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, expand); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedInstanceResource(Client, ManagedInstanceData.DeserializeManagedInstanceData(e)), ManagedInstanceClientDiagnostics, Pipeline, "MockableSqlSubscriptionResource.GetManagedInstances", "value", "nextLink", cancellationToken); + } + /// /// Determines whether a resource can be created with the specified name. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs index 84185a040f19..3d3936c02a72 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Extensions/SqlExtensions.cs @@ -1554,25 +1554,6 @@ public static SqlServerConnectionPolicyResource GetSqlServerConnectionPolicyReso return GetMockableSqlArmClient(client).GetSqlServerConnectionPolicyResource(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 DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetDistributedAvailabilityGroupResource(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. @@ -1953,25 +1934,6 @@ public static ManagedDatabaseResource GetManagedDatabaseResource(this ArmClient return GetMockableSqlArmClient(client).GetManagedDatabaseResource(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 ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) - { - Argument.AssertNotNull(client, nameof(client)); - - return GetMockableSqlArmClient(client).GetManagedInstanceResource(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. @@ -2390,6 +2352,25 @@ public static LongTermRetentionPolicyResource GetLongTermRetentionPolicyResource return GetMockableSqlArmClient(client).GetLongTermRetentionPolicyResource(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 ManagedInstanceResource GetManagedInstanceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSqlArmClient(client).GetManagedInstanceResource(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. @@ -2428,6 +2409,25 @@ public static SqlServerDatabaseReplicationLinkResource GetSqlServerDatabaseRepli return GetMockableSqlArmClient(client).GetSqlServerDatabaseReplicationLinkResource(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 DistributedAvailabilityGroupResource GetDistributedAvailabilityGroupResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSqlArmClient(client).GetDistributedAvailabilityGroupResource(id); + } + /// /// Gets a collection of SqlServerTrustGroupResources in the ResourceGroupResource. /// @@ -2817,127 +2817,129 @@ public static Response GetInstanceFailoverGroup(t } /// - /// Gets a collection of ManagedInstanceResources in the ResourceGroupResource. + /// Gets a collection of InstancePoolResources 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 ManagedInstanceResources and their operations over a ManagedInstanceResource. - public static ManagedInstanceCollection GetManagedInstances(this ResourceGroupResource resourceGroupResource) + /// An object representing collection of InstancePoolResources and their operations over a InstancePoolResource. + public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstances(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); } /// - /// Gets a managed instance. + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// ManagedInstances_Get + /// InstancePools_Get /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// 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 instance. - /// The child resources to include in the response. + /// The name of the instance pool to be retrieved. /// 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> GetManagedInstanceAsync(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstanceAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); } /// - /// Gets a managed instance. + /// Gets an instance pool. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} /// /// /// Operation Id - /// ManagedInstances_Get + /// InstancePools_Get /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// 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 instance. - /// The child resources to include in the response. + /// The name of the instance pool to be retrieved. /// 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 GetManagedInstance(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) + public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstance(managedInstanceName, expand, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); } /// - /// Gets a collection of InstancePoolResources in the ResourceGroupResource. + /// Gets a collection of ResourceGroupLongTermRetentionBackupResources 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 InstancePoolResources and their operations over a InstancePoolResource. - public static InstancePoolCollection GetInstancePools(this ResourceGroupResource resourceGroupResource) + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. + public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePools(); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); } /// - /// Gets an instance pool. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// InstancePools_Get + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// Default Api Version @@ -2945,37 +2947,40 @@ public static InstancePoolCollection GetInstancePools(this ResourceGroupResource /// /// /// 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 instance pool to be retrieved. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetInstancePoolAsync(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static async Task> GetResourceGroupLongTermRetentionBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePoolAsync(instancePoolName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); } /// - /// Gets an instance pool. + /// Gets a long term retention backup. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/instancePools/{instancePoolName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} /// /// /// Operation Id - /// InstancePools_Get + /// LongTermRetentionBackups_GetByResourceGroup /// /// /// Default Api Version @@ -2983,58 +2988,57 @@ public static async Task> GetInstancePoolAsync(th /// /// /// 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 instance pool to be retrieved. + /// The location of the database. + /// The name of the server. + /// The name of the database. + /// The backup name. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetInstancePool(this ResourceGroupResource resourceGroupResource, string instancePoolName, CancellationToken cancellationToken = default) + public static Response GetResourceGroupLongTermRetentionBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetInstancePool(instancePoolName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); } /// - /// Gets a collection of ResourceGroupLongTermRetentionBackupResources in the ResourceGroupResource. + /// Gets a collection of ManagedInstanceResources 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. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// , or is null. - /// or is an empty string, and was expected to be non-empty. - /// An object representing collection of ResourceGroupLongTermRetentionBackupResources and their operations over a ResourceGroupLongTermRetentionBackupResource. - public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLongTermRetentionBackups(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName) + /// is null. + /// An object representing collection of ManagedInstanceResources and their operations over a ManagedInstanceResource. + public static ManagedInstanceCollection GetManagedInstances(this ResourceGroupResource resourceGroupResource) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackups(locationName, longTermRetentionServerName, longTermRetentionDatabaseName); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstances(); } /// - /// Gets a long term retention backup. + /// Gets a managed instance. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} /// /// /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup + /// ManagedInstances_Get /// /// /// Default Api Version @@ -3042,40 +3046,38 @@ public static ResourceGroupLongTermRetentionBackupCollection GetResourceGroupLon /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. + /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - /// , or 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> GetResourceGroupLongTermRetentionBackupAsync(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public static async Task> GetManagedInstanceAsync(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackupAsync(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken).ConfigureAwait(false); + return await GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstanceAsync(managedInstanceName, expand, cancellationToken).ConfigureAwait(false); } /// - /// Gets a long term retention backup. + /// Gets a managed instance. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/locations/{locationName}/longTermRetentionServers/{longTermRetentionServerName}/longTermRetentionDatabases/{longTermRetentionDatabaseName}/longTermRetentionBackups/{backupName} + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName} /// /// /// Operation Id - /// LongTermRetentionBackups_GetByResourceGroup + /// ManagedInstances_Get /// /// /// Default Api Version @@ -3083,28 +3085,26 @@ public static async Task> /// /// /// Resource - /// + /// /// /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location of the database. - /// The name of the server. - /// The name of the database. - /// The backup name. + /// The name of the managed instance. + /// The child resources to include in the response. /// The cancellation token to use. - /// , , or is null. - /// , or 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 GetResourceGroupLongTermRetentionBackup(this ResourceGroupResource resourceGroupResource, AzureLocation locationName, string longTermRetentionServerName, string longTermRetentionDatabaseName, string backupName, CancellationToken cancellationToken = default) + public static Response GetManagedInstance(this ResourceGroupResource resourceGroupResource, string managedInstanceName, string expand = null, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableSqlResourceGroupResource(resourceGroupResource).GetResourceGroupLongTermRetentionBackup(locationName, longTermRetentionServerName, longTermRetentionDatabaseName, backupName, cancellationToken); + return GetMockableSqlResourceGroupResource(resourceGroupResource).GetManagedInstance(managedInstanceName, expand, cancellationToken); } /// @@ -4412,80 +4412,6 @@ public static Pageable GetVirtualClusters(this Subscript return GetMockableSqlSubscriptionResource(subscriptionResource).GetVirtualClusters(cancellationToken); } - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetManagedInstancesAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstancesAsync(expand, cancellationToken); - } - - /// - /// Gets a list of all managed instances in the subscription. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances - /// - /// - /// Operation Id - /// ManagedInstances_List - /// - /// - /// Default Api Version - /// 2022-08-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// Mocking - /// To mock this method, please mock instead. - /// - /// - /// The instance the method will execute against. - /// The child resources to include in the response. - /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetManagedInstances(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - - return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstances(expand, cancellationToken); - } - /// /// Gets a list of all instance pools in the subscription. /// @@ -4702,6 +4628,80 @@ public static Pageable GetLongTermRetentionBackupsW return GetMockableSqlSubscriptionResource(subscriptionResource).GetLongTermRetentionBackupsWithServer(locationName, longTermRetentionServerName, onlyLatestPerDatabase, databaseState, cancellationToken); } + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetManagedInstancesAsync(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstancesAsync(expand, cancellationToken); + } + + /// + /// Gets a list of all managed instances in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Sql/managedInstances + /// + /// + /// Operation Id + /// ManagedInstances_List + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The child resources to include in the response. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetManagedInstances(this SubscriptionResource subscriptionResource, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSqlSubscriptionResource(subscriptionResource).GetManagedInstances(expand, cancellationToken); + } + /// /// Determines whether a resource can be created with the specified name. /// diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs index 531a2500f6e3..45e517fb6c55 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/InstancePoolResource.cs @@ -423,7 +423,7 @@ public virtual Pageable GetUsages(bool? expandChildren = null /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -454,7 +454,7 @@ public virtual AsyncPageable GetManagedInstancesAsync(s /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/RefreshExternalGovernanceStatusOperationResultMIOperationSource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/RefreshExternalGovernanceStatusOperationResultMIOperationSource.cs new file mode 100644 index 000000000000..a989716df58c --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/LongRunningOperation/RefreshExternalGovernanceStatusOperationResultMIOperationSource.cs @@ -0,0 +1,30 @@ +// 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.Sql.Models; + +namespace Azure.ResourceManager.Sql +{ + internal class RefreshExternalGovernanceStatusOperationResultMIOperationSource : IOperationSource + { + RefreshExternalGovernanceStatusOperationResultMI IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return RefreshExternalGovernanceStatusOperationResultMI.DeserializeRefreshExternalGovernanceStatusOperationResultMI(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return RefreshExternalGovernanceStatusOperationResultMI.DeserializeRefreshExternalGovernanceStatusOperationResultMI(document.RootElement); + } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs index da7e4b72be37..05740e916f2e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateA /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -209,7 +209,7 @@ public virtual async Task> GetAsync(string man /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -255,7 +255,7 @@ public virtual Response Get(string managedInstanceName, /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -286,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(string expand /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(string expand = null, Ca /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -361,7 +361,7 @@ public virtual async Task> ExistsAsync(string managedInstanceName /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -405,7 +405,7 @@ public virtual Response Exists(string managedInstanceName, string expand = /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -451,7 +451,7 @@ public virtual async Task> GetIfExists /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.Serialization.cs index 2574c2fa1420..fd38cee94f14 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.Serialization.cs @@ -67,6 +67,11 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("fullyQualifiedDomainName"u8); writer.WriteStringValue(FullyQualifiedDomainName); } + if (Optional.IsDefined(IsGeneralPurposeV2)) + { + writer.WritePropertyName("isGeneralPurposeV2"u8); + writer.WriteBooleanValue(IsGeneralPurposeV2.Value); + } if (Optional.IsDefined(AdministratorLogin)) { writer.WritePropertyName("administratorLogin"u8); @@ -92,6 +97,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("licenseType"u8); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(HybridSecondaryUsage)) + { + writer.WritePropertyName("hybridSecondaryUsage"u8); + writer.WriteStringValue(HybridSecondaryUsage.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(HybridSecondaryUsageDetected)) + { + writer.WritePropertyName("hybridSecondaryUsageDetected"u8); + writer.WriteStringValue(HybridSecondaryUsageDetected.Value.ToString()); + } if (Optional.IsDefined(VCores)) { writer.WritePropertyName("vCores"u8); @@ -102,6 +117,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("storageSizeInGB"u8); writer.WriteNumberValue(StorageSizeInGB.Value); } + if (Optional.IsDefined(StorageIOps)) + { + writer.WritePropertyName("storageIOps"u8); + writer.WriteNumberValue(StorageIOps.Value); + } + if (Optional.IsDefined(StorageThroughputMBps)) + { + writer.WritePropertyName("storageThroughputMBps"u8); + writer.WriteNumberValue(StorageThroughputMBps.Value); + } if (Optional.IsDefined(Collation)) { writer.WritePropertyName("collation"u8); @@ -202,6 +227,36 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("servicePrincipal"u8); writer.WriteObjectValue(ServicePrincipal, options); } + if (options.Format != "W" && Optional.IsDefined(VirtualClusterId)) + { + writer.WritePropertyName("virtualClusterId"u8); + writer.WriteStringValue(VirtualClusterId); + } + if (options.Format != "W" && Optional.IsDefined(ExternalGovernanceStatus)) + { + writer.WritePropertyName("externalGovernanceStatus"u8); + writer.WriteStringValue(ExternalGovernanceStatus.Value.ToString()); + } + if (Optional.IsDefined(PricingModel)) + { + writer.WritePropertyName("pricingModel"u8); + writer.WriteStringValue(PricingModel.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreateOn)) + { + writer.WritePropertyName("createTime"u8); + writer.WriteStringValue(CreateOn.Value, "O"); + } + if (Optional.IsDefined(AuthenticationMetadata)) + { + writer.WritePropertyName("authenticationMetadata"u8); + writer.WriteStringValue(AuthenticationMetadata.Value.ToString()); + } + if (Optional.IsDefined(DatabaseFormat)) + { + writer.WritePropertyName("databaseFormat"u8); + writer.WriteStringValue(DatabaseFormat.Value.ToString()); + } writer.WriteEndObject(); } @@ -233,16 +288,21 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e string name = default; ResourceType type = default; SystemData systemData = default; - ManagedInstancePropertiesProvisioningState? provisioningState = default; + JobExecutionProvisioningState? provisioningState = default; ManagedServerCreateMode? managedInstanceCreateMode = default; string fullyQualifiedDomainName = default; + bool? isGeneralPurposeV2 = default; string administratorLogin = default; string administratorLoginPassword = default; ResourceIdentifier subnetId = default; string state = default; ManagedInstanceLicenseType? licenseType = default; + HybridSecondaryUsage? hybridSecondaryUsage = default; + HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default; int? vCores = default; int? storageSizeInGB = default; + int? storageIOps = default; + int? storageThroughputMBps = default; string collation = default; string dnsZone = default; ResourceIdentifier dnsZonePartner = default; @@ -262,6 +322,12 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e Uri keyId = default; ManagedInstanceExternalAdministrator administrators = default; SqlServicePrincipal servicePrincipal = default; + string virtualClusterId = default; + ExternalGovernanceStatus? externalGovernanceStatus = default; + FreemiumType? pricingModel = default; + DateTimeOffset? createTime = default; + AuthMetadataLookupMode? authenticationMetadata = default; + ManagedInstanceDatabaseFormat? databaseFormat = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -343,7 +409,7 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e { continue; } - provisioningState = new ManagedInstancePropertiesProvisioningState(property0.Value.GetString()); + provisioningState = new JobExecutionProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("managedInstanceCreateMode"u8)) @@ -360,6 +426,15 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e fullyQualifiedDomainName = property0.Value.GetString(); continue; } + if (property0.NameEquals("isGeneralPurposeV2"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isGeneralPurposeV2 = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("administratorLogin"u8)) { administratorLogin = property0.Value.GetString(); @@ -393,6 +468,24 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e licenseType = new ManagedInstanceLicenseType(property0.Value.GetString()); continue; } + if (property0.NameEquals("hybridSecondaryUsage"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hybridSecondaryUsage = new HybridSecondaryUsage(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("hybridSecondaryUsageDetected"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hybridSecondaryUsageDetected = new HybridSecondaryUsageDetected(property0.Value.GetString()); + continue; + } if (property0.NameEquals("vCores"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -411,6 +504,24 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e storageSizeInGB = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("storageIOps"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageIOps = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("storageThroughputMBps"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageThroughputMBps = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("collation"u8)) { collation = property0.Value.GetString(); @@ -571,6 +682,56 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e servicePrincipal = SqlServicePrincipal.DeserializeSqlServicePrincipal(property0.Value, options); continue; } + if (property0.NameEquals("virtualClusterId"u8)) + { + virtualClusterId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("externalGovernanceStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + externalGovernanceStatus = new ExternalGovernanceStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("pricingModel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pricingModel = new FreemiumType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("createTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("authenticationMetadata"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authenticationMetadata = new AuthMetadataLookupMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("databaseFormat"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + databaseFormat = new ManagedInstanceDatabaseFormat(property0.Value.GetString()); + continue; + } } continue; } @@ -592,13 +753,18 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e provisioningState, managedInstanceCreateMode, fullyQualifiedDomainName, + isGeneralPurposeV2, administratorLogin, administratorLoginPassword, subnetId, state, licenseType, + hybridSecondaryUsage, + hybridSecondaryUsageDetected, vCores, storageSizeInGB, + storageIOps, + storageThroughputMBps, collation, dnsZone, dnsZonePartner, @@ -618,6 +784,12 @@ internal static ManagedInstanceData DeserializeManagedInstanceData(JsonElement e keyId, administrators, servicePrincipal, + virtualClusterId, + externalGovernanceStatus, + pricingModel, + createTime, + authenticationMetadata, + databaseFormat, serializedAdditionalRawData); } @@ -819,6 +991,22 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsGeneralPurposeV2), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" isGeneralPurposeV2: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsGeneralPurposeV2)) + { + builder.Append(" isGeneralPurposeV2: "); + var boolValue = IsGeneralPurposeV2.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdministratorLogin), out propertyOverride); if (hasPropertyOverride) { @@ -918,6 +1106,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HybridSecondaryUsage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hybridSecondaryUsage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HybridSecondaryUsage)) + { + builder.Append(" hybridSecondaryUsage: "); + builder.AppendLine($"'{HybridSecondaryUsage.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HybridSecondaryUsageDetected), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hybridSecondaryUsageDetected: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HybridSecondaryUsageDetected)) + { + builder.Append(" hybridSecondaryUsageDetected: "); + builder.AppendLine($"'{HybridSecondaryUsageDetected.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VCores), out propertyOverride); if (hasPropertyOverride) { @@ -948,6 +1166,36 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageIOps), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storageIOps: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageIOps)) + { + builder.Append(" storageIOps: "); + builder.AppendLine($"{StorageIOps.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageThroughputMBps), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storageThroughputMBps: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageThroughputMBps)) + { + builder.Append(" storageThroughputMBps: "); + builder.AppendLine($"{StorageThroughputMBps.Value}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Collation), out propertyOverride); if (hasPropertyOverride) { @@ -1276,6 +1524,105 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VirtualClusterId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" virtualClusterId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VirtualClusterId)) + { + builder.Append(" virtualClusterId: "); + if (VirtualClusterId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VirtualClusterId}'''"); + } + else + { + builder.AppendLine($"'{VirtualClusterId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExternalGovernanceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" externalGovernanceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExternalGovernanceStatus)) + { + builder.Append(" externalGovernanceStatus: "); + builder.AppendLine($"'{ExternalGovernanceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PricingModel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" pricingModel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PricingModel)) + { + builder.Append(" pricingModel: "); + builder.AppendLine($"'{PricingModel.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreateOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" createTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CreateOn)) + { + builder.Append(" createTime: "); + var formattedDateTimeString = TypeFormatters.ToString(CreateOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AuthenticationMetadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" authenticationMetadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AuthenticationMetadata)) + { + builder.Append(" authenticationMetadata: "); + builder.AppendLine($"'{AuthenticationMetadata.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DatabaseFormat), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" databaseFormat: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DatabaseFormat)) + { + builder.Append(" databaseFormat: "); + builder.AppendLine($"'{DatabaseFormat.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs index 05cf67810f7d..b02a00aad14e 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceData.cs @@ -67,7 +67,7 @@ public ManagedInstanceData(AzureLocation location) : base(location) /// The location. /// The Azure Active Directory identity of the managed instance. /// Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, BC_Gen5, BC_G8IM, BC_G8IH. - /// + /// Provisioning state of managed instance. /// /// Specifies the mode of database creation. /// @@ -76,13 +76,18 @@ public ManagedInstanceData(AzureLocation location) : base(location) /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. /// /// The fully qualified domain name of the managed instance. + /// Whether or not this is a GPv2 variant of General Purpose edition. /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). /// The administrator login password (required for managed instance creation). /// Subnet resource ID for the managed instance. /// The state of the managed instance. /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage throughput MBps parameter is not supported in the instance create/update operation. /// Collation of the managed instance. /// The Dns Zone that the managed instance is in. /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. @@ -109,21 +114,32 @@ public ManagedInstanceData(AzureLocation location) : base(location) /// A CMK URI of the key to use for encryption. /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. /// The managed instance's service principal. + /// Virtual cluster resource id for the Managed Instance. + /// Status of external governance. + /// Weather or not Managed Instance is freemium. + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + /// The managed instance's authentication metadata lookup mode. + /// Specifies the internal format of instance databases specific to the SQL engine version. /// Keeps track of any properties unknown to the library. - internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, ResourceIdentifier subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, ResourceIdentifier managedDnsZonePartner, bool? isPublicDataEndpointEnabled, ResourceIdentifier sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, ResourceIdentifier instancePoolId, ResourceIdentifier maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, SqlBackupStorageRedundancy? currentBackupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy, bool? isZoneRedundant, ResourceIdentifier primaryUserAssignedIdentityId, Uri keyId, ManagedInstanceExternalAdministrator administrators, SqlServicePrincipal servicePrincipal, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ManagedServiceIdentity identity, SqlSku sku, JobExecutionProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, bool? isGeneralPurposeV2, string administratorLogin, string administratorLoginPassword, ResourceIdentifier subnetId, string state, ManagedInstanceLicenseType? licenseType, HybridSecondaryUsage? hybridSecondaryUsage, HybridSecondaryUsageDetected? hybridSecondaryUsageDetected, int? vCores, int? storageSizeInGB, int? storageIOps, int? storageThroughputMBps, string collation, string dnsZone, ResourceIdentifier managedDnsZonePartner, bool? isPublicDataEndpointEnabled, ResourceIdentifier sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, ResourceIdentifier instancePoolId, ResourceIdentifier maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, SqlBackupStorageRedundancy? currentBackupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy, bool? isZoneRedundant, ResourceIdentifier primaryUserAssignedIdentityId, Uri keyId, ManagedInstanceExternalAdministrator administrators, SqlServicePrincipal servicePrincipal, string virtualClusterId, ExternalGovernanceStatus? externalGovernanceStatus, FreemiumType? pricingModel, DateTimeOffset? createOn, AuthMetadataLookupMode? authenticationMetadata, ManagedInstanceDatabaseFormat? databaseFormat, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Identity = identity; Sku = sku; ProvisioningState = provisioningState; ManagedInstanceCreateMode = managedInstanceCreateMode; FullyQualifiedDomainName = fullyQualifiedDomainName; + IsGeneralPurposeV2 = isGeneralPurposeV2; AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; SubnetId = subnetId; State = state; LicenseType = licenseType; + HybridSecondaryUsage = hybridSecondaryUsage; + HybridSecondaryUsageDetected = hybridSecondaryUsageDetected; VCores = vCores; StorageSizeInGB = storageSizeInGB; + StorageIOps = storageIOps; + StorageThroughputMBps = storageThroughputMBps; Collation = collation; DnsZone = dnsZone; ManagedDnsZonePartner = managedDnsZonePartner; @@ -143,6 +159,12 @@ internal ManagedInstanceData(ResourceIdentifier id, string name, ResourceType re KeyId = keyId; Administrators = administrators; ServicePrincipal = servicePrincipal; + VirtualClusterId = virtualClusterId; + ExternalGovernanceStatus = externalGovernanceStatus; + PricingModel = pricingModel; + CreateOn = createOn; + AuthenticationMetadata = authenticationMetadata; + DatabaseFormat = databaseFormat; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -157,9 +179,9 @@ internal ManagedInstanceData() /// Managed instance SKU. Allowed values for sku.name: GP_Gen5, GP_G8IM, GP_G8IH, BC_Gen5, BC_G8IM, BC_G8IH. [WirePath("sku")] public SqlSku Sku { get; set; } - /// Gets the provisioning state. + /// Provisioning state of managed instance. [WirePath("properties.provisioningState")] - public ManagedInstancePropertiesProvisioningState? ProvisioningState { get; } + public JobExecutionProvisioningState? ProvisioningState { get; } /// /// Specifies the mode of database creation. /// @@ -172,6 +194,9 @@ internal ManagedInstanceData() /// The fully qualified domain name of the managed instance. [WirePath("properties.fullyQualifiedDomainName")] public string FullyQualifiedDomainName { get; } + /// Whether or not this is a GPv2 variant of General Purpose edition. + [WirePath("properties.isGeneralPurposeV2")] + public bool? IsGeneralPurposeV2 { get; set; } /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). [WirePath("properties.administratorLogin")] public string AdministratorLogin { get; set; } @@ -187,12 +212,24 @@ internal ManagedInstanceData() /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). [WirePath("properties.licenseType")] public ManagedInstanceLicenseType? LicenseType { get; set; } + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + [WirePath("properties.hybridSecondaryUsage")] + public HybridSecondaryUsage? HybridSecondaryUsage { get; set; } + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). + [WirePath("properties.hybridSecondaryUsageDetected")] + public HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get; } /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. [WirePath("properties.vCores")] public int? VCores { get; set; } /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. [WirePath("properties.storageSizeInGB")] public int? StorageSizeInGB { get; set; } + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + [WirePath("properties.storageIOps")] + public int? StorageIOps { get; set; } + /// Storage throughput MBps parameter is not supported in the instance create/update operation. + [WirePath("properties.storageThroughputMBps")] + public int? StorageThroughputMBps { get; set; } /// Collation of the managed instance. [WirePath("properties.collation")] public string Collation { get; set; } @@ -257,5 +294,23 @@ internal ManagedInstanceData() /// The managed instance's service principal. [WirePath("properties.servicePrincipal")] public SqlServicePrincipal ServicePrincipal { get; set; } + /// Virtual cluster resource id for the Managed Instance. + [WirePath("properties.virtualClusterId")] + public string VirtualClusterId { get; } + /// Status of external governance. + [WirePath("properties.externalGovernanceStatus")] + public ExternalGovernanceStatus? ExternalGovernanceStatus { get; } + /// Weather or not Managed Instance is freemium. + [WirePath("properties.pricingModel")] + public FreemiumType? PricingModel { get; set; } + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + [WirePath("properties.createTime")] + public DateTimeOffset? CreateOn { get; } + /// The managed instance's authentication metadata lookup mode. + [WirePath("properties.authenticationMetadata")] + public AuthMetadataLookupMode? AuthenticationMetadata { get; set; } + /// Specifies the internal format of instance databases specific to the SQL engine version. + [WirePath("properties.databaseFormat")] + public ManagedInstanceDatabaseFormat? DatabaseFormat { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs index cf3a8f029f09..c77034e3342f 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/ManagedInstanceResource.cs @@ -847,75 +847,6 @@ public virtual Response GetRestorableD return GetRestorableDroppedManagedDatabases().Get(restorableDroppedDatabaseId, cancellationToken); } - /// Gets a collection of DistributedAvailabilityGroupResources in the ManagedInstance. - /// An object representing collection of DistributedAvailabilityGroupResources and their operations over a DistributedAvailabilityGroupResource. - public virtual DistributedAvailabilityGroupCollection GetDistributedAvailabilityGroups() - { - return GetCachedClient(client => new DistributedAvailabilityGroupCollection(client, Id)); - } - - /// - /// Gets a distributed availability group info. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} - /// - /// - /// Operation Id - /// DistributedAvailabilityGroups_Get - /// - /// - /// Default Api Version - /// 2021-11-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The distributed availability group name. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual async Task> GetDistributedAvailabilityGroupAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) - { - return await GetDistributedAvailabilityGroups().GetAsync(distributedAvailabilityGroupName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Gets a distributed availability group info. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} - /// - /// - /// Operation Id - /// DistributedAvailabilityGroups_Get - /// - /// - /// Default Api Version - /// 2021-11-01-preview - /// - /// - /// Resource - /// - /// - /// - /// - /// The distributed availability group name. - /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - [ForwardsClientCalls] - public virtual Response GetDistributedAvailabilityGroup(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) - { - return GetDistributedAvailabilityGroups().Get(distributedAvailabilityGroupName, cancellationToken); - } - /// Gets a collection of ManagedInstanceServerTrustCertificateResources in the ManagedInstance. /// An object representing collection of ManagedInstanceServerTrustCertificateResources and their operations over a ManagedInstanceServerTrustCertificateResource. public virtual ManagedInstanceServerTrustCertificateCollection GetManagedInstanceServerTrustCertificates() @@ -1452,6 +1383,75 @@ public virtual Response GetManagedInst return GetManagedInstanceStartStopSchedules().Get(startStopScheduleName, cancellationToken); } + /// Gets a collection of DistributedAvailabilityGroupResources in the ManagedInstance. + /// An object representing collection of DistributedAvailabilityGroupResources and their operations over a DistributedAvailabilityGroupResource. + public virtual DistributedAvailabilityGroupCollection GetDistributedAvailabilityGroups() + { + return GetCachedClient(client => new DistributedAvailabilityGroupCollection(client, Id)); + } + + /// + /// Gets a distributed availability group info. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Get + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDistributedAvailabilityGroupAsync(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + return await GetDistributedAvailabilityGroups().GetAsync(distributedAvailabilityGroupName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a distributed availability group info. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/distributedAvailabilityGroups/{distributedAvailabilityGroupName} + /// + /// + /// Operation Id + /// DistributedAvailabilityGroups_Get + /// + /// + /// Default Api Version + /// 2023-08-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The distributed availability group name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDistributedAvailabilityGroup(string distributedAvailabilityGroupName, CancellationToken cancellationToken = default) + { + return GetDistributedAvailabilityGroups().Get(distributedAvailabilityGroupName, cancellationToken); + } + /// /// Gets a managed instance. /// @@ -1465,7 +1465,7 @@ public virtual Response GetManagedInst /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1506,7 +1506,7 @@ public virtual async Task> GetAsync(string exp /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1547,7 +1547,7 @@ public virtual Response Get(string expand = null, Cance /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1589,7 +1589,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1631,7 +1631,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1677,7 +1677,7 @@ public virtual async Task> UpdateAsync(Wai /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1927,7 +1927,7 @@ public virtual Pageable GetInaccessibleManagedDatabases /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -1970,7 +1970,7 @@ public virtual async Task FailoverAsync(WaitUntil waitUntil, Repli /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2013,7 +2013,7 @@ public virtual ArmOperation Failover(WaitUntil waitUntil, ReplicaType? replicaTy /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2043,7 +2043,7 @@ public virtual AsyncPageable GetOutboundNetworkD /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2060,6 +2060,90 @@ public virtual Pageable GetOutboundNetworkDepend return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => SqlOutboundEnvironmentEndpoint.DeserializeSqlOutboundEnvironmentEndpoint(e), _managedInstanceClientDiagnostics, Pipeline, "ManagedInstanceResource.GetOutboundNetworkDependencies", "value", "nextLink", cancellationToken); } + /// + /// Refresh external governance enablement status. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/refreshExternalGovernanceStatus + /// + /// + /// Operation Id + /// ManagedInstances_RefreshStatus + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> RefreshStatusAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.RefreshStatus"); + scope.Start(); + try + { + var response = await _managedInstanceRestClient.RefreshStatusAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SqlArmOperation(new RefreshExternalGovernanceStatusOperationResultMIOperationSource(), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateRefreshStatusRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh external governance enablement status. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Sql/managedInstances/{managedInstanceName}/refreshExternalGovernanceStatus + /// + /// + /// Operation Id + /// ManagedInstances_RefreshStatus + /// + /// + /// Default Api Version + /// 2023-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation RefreshStatus(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.RefreshStatus"); + scope.Start(); + try + { + var response = _managedInstanceRestClient.RefreshStatus(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new SqlArmOperation(new RefreshExternalGovernanceStatusOperationResultMIOperationSource(), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateRefreshStatusRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Starts the managed instance. /// @@ -2073,7 +2157,7 @@ public virtual Pageable GetOutboundNetworkDepend /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2083,16 +2167,16 @@ public virtual Pageable GetOutboundNetworkDepend /// /// 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) + public virtual async Task> StartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.Start"); scope.Start(); try { var response = await _managedInstanceRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ManagedInstanceOperationSource(Client), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -2115,7 +2199,7 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2125,16 +2209,16 @@ public virtual async Task StartAsync(WaitUntil waitUntil, Cancella /// /// 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) + public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.Start"); scope.Start(); try { var response = _managedInstanceRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new SqlArmOperation(_managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ManagedInstanceOperationSource(Client), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -2157,7 +2241,7 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2167,16 +2251,16 @@ public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancell /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The cancellation token to use. - public virtual async Task StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + public virtual async Task> StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.Stop"); scope.Start(); try { var response = await _managedInstanceRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new SqlArmOperation(_managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ManagedInstanceOperationSource(Client), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; } catch (Exception e) @@ -2199,7 +2283,7 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2209,16 +2293,16 @@ public virtual async Task StopAsync(WaitUntil waitUntil, Cancellat /// /// 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) + public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancellationToken = default) { using var scope = _managedInstanceClientDiagnostics.CreateScope("ManagedInstanceResource.Stop"); scope.Start(); try { var response = _managedInstanceRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); - var operation = new SqlArmOperation(_managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + var operation = new SqlArmOperation(new ManagedInstanceOperationSource(Client), _managedInstanceClientDiagnostics, Pipeline, _managedInstanceRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) - operation.WaitForCompletionResponse(cancellationToken); + operation.WaitForCompletion(cancellationToken); return operation; } catch (Exception e) @@ -2241,7 +2325,7 @@ public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancella /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2274,7 +2358,7 @@ public virtual AsyncPageable GetTopQueriesAsync(ManagedInstanceResou /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2307,7 +2391,7 @@ public virtual Pageable GetTopQueries(ManagedInstanceResourceGetTopQ /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2369,7 +2453,7 @@ public virtual async Task> AddTagAsync(string /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2431,7 +2515,7 @@ public virtual Response AddTag(string key, string value /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2488,7 +2572,7 @@ public virtual async Task> SetTagsAsync(IDicti /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2545,7 +2629,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource @@ -2605,7 +2689,7 @@ public virtual async Task> RemoveTagAsync(stri /// /// /// Default Api Version - /// 2022-08-01-preview + /// 2023-05-01-preview /// /// /// Resource diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthMetadataLookupMode.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthMetadataLookupMode.cs new file mode 100644 index 000000000000..3c2bd9dfdffa --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/AuthMetadataLookupMode.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.Sql.Models +{ + /// The managed instance's authentication metadata lookup mode. + public readonly partial struct AuthMetadataLookupMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthMetadataLookupMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureADValue = "AzureAD"; + private const string PairedValue = "Paired"; + private const string WindowsValue = "Windows"; + + /// AzureAD. + public static AuthMetadataLookupMode AzureAD { get; } = new AuthMetadataLookupMode(AzureADValue); + /// Paired. + public static AuthMetadataLookupMode Paired { get; } = new AuthMetadataLookupMode(PairedValue); + /// Windows. + public static AuthMetadataLookupMode Windows { get; } = new AuthMetadataLookupMode(WindowsValue); + /// Determines if two values are the same. + public static bool operator ==(AuthMetadataLookupMode left, AuthMetadataLookupMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthMetadataLookupMode left, AuthMetadataLookupMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthMetadataLookupMode(string value) => new AuthMetadataLookupMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthMetadataLookupMode other && Equals(other); + /// + public bool Equals(AuthMetadataLookupMode 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.Serialization.cs new file mode 100644 index 000000000000..e11f63068edd --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.Serialization.cs @@ -0,0 +1,201 @@ +// 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.Sql.Models +{ + public partial class CertificateInfo : 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(CertificateInfo)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(CertificateName)) + { + writer.WritePropertyName("certificateName"u8); + writer.WriteStringValue(CertificateName); + } + if (options.Format != "W" && Optional.IsDefined(ExpiryOn)) + { + writer.WritePropertyName("expiryDate"u8); + writer.WriteStringValue(ExpiryOn.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CertificateInfo 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(CertificateInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCertificateInfo(document.RootElement, options); + } + + internal static CertificateInfo DeserializeCertificateInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string certificateName = default; + DateTimeOffset? expiryDate = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("certificateName"u8)) + { + certificateName = property.Value.GetString(); + continue; + } + if (property.NameEquals("expiryDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expiryDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CertificateInfo(certificateName, expiryDate, 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(CertificateName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" certificateName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CertificateName)) + { + builder.Append(" certificateName: "); + if (CertificateName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CertificateName}'''"); + } + else + { + builder.AppendLine($"'{CertificateName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExpiryOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" expiryDate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExpiryOn)) + { + builder.Append(" expiryDate: "); + var formattedDateTimeString = TypeFormatters.ToString(ExpiryOn.Value, "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(CertificateInfo)} does not support writing '{options.Format}' format."); + } + } + + CertificateInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCertificateInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CertificateInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.cs new file mode 100644 index 000000000000..af5c43c38aaf --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/CertificateInfo.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Certificate information. + public partial class CertificateInfo + { + /// + /// 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 CertificateInfo() + { + } + + /// Initializes a new instance of . + /// The certificate name. + /// The certificate expiry date. + /// Keeps track of any properties unknown to the library. + internal CertificateInfo(string certificateName, DateTimeOffset? expiryOn, IDictionary serializedAdditionalRawData) + { + CertificateName = certificateName; + ExpiryOn = expiryOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The certificate name. + [WirePath("certificateName")] + public string CertificateName { get; } + /// The certificate expiry date. + [WirePath("expiryDate")] + public DateTimeOffset? ExpiryOn { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.Serialization.cs new file mode 100644 index 000000000000..4da4dbea300b --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.Serialization.cs @@ -0,0 +1,829 @@ +// 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.Sql.Models +{ + public partial class DistributedAvailabilityGroupDatabase : 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(DistributedAvailabilityGroupDatabase)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + } + if (options.Format != "W" && Optional.IsDefined(InstanceReplicaId)) + { + writer.WritePropertyName("instanceReplicaId"u8); + writer.WriteStringValue(InstanceReplicaId.Value); + } + if (options.Format != "W" && Optional.IsDefined(PartnerReplicaId)) + { + writer.WritePropertyName("partnerReplicaId"u8); + writer.WriteStringValue(PartnerReplicaId.Value); + } + if (options.Format != "W" && Optional.IsDefined(ReplicaState)) + { + writer.WritePropertyName("replicaState"u8); + writer.WriteStringValue(ReplicaState); + } + if (options.Format != "W" && Optional.IsDefined(SeedingProgress)) + { + writer.WritePropertyName("seedingProgress"u8); + writer.WriteStringValue(SeedingProgress); + } + if (options.Format != "W" && Optional.IsDefined(SynchronizationHealth)) + { + writer.WritePropertyName("synchronizationHealth"u8); + writer.WriteStringValue(SynchronizationHealth.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ConnectedState)) + { + writer.WritePropertyName("connectedState"u8); + writer.WriteStringValue(ConnectedState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(LastReceivedLsn)) + { + writer.WritePropertyName("lastReceivedLsn"u8); + writer.WriteStringValue(LastReceivedLsn); + } + if (options.Format != "W" && Optional.IsDefined(LastReceivedOn)) + { + writer.WritePropertyName("lastReceivedTime"u8); + writer.WriteStringValue(LastReceivedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastSentLsn)) + { + writer.WritePropertyName("lastSentLsn"u8); + writer.WriteStringValue(LastSentLsn); + } + if (options.Format != "W" && Optional.IsDefined(LastSentOn)) + { + writer.WritePropertyName("lastSentTime"u8); + writer.WriteStringValue(LastSentOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastCommitLsn)) + { + writer.WritePropertyName("lastCommitLsn"u8); + writer.WriteStringValue(LastCommitLsn); + } + if (options.Format != "W" && Optional.IsDefined(LastCommitOn)) + { + writer.WritePropertyName("lastCommitTime"u8); + writer.WriteStringValue(LastCommitOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastHardenedLsn)) + { + writer.WritePropertyName("lastHardenedLsn"u8); + writer.WriteStringValue(LastHardenedLsn); + } + if (options.Format != "W" && Optional.IsDefined(LastHardenedOn)) + { + writer.WritePropertyName("lastHardenedTime"u8); + writer.WriteStringValue(LastHardenedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(LastBackupLsn)) + { + writer.WritePropertyName("lastBackupLsn"u8); + writer.WriteStringValue(LastBackupLsn); + } + if (options.Format != "W" && Optional.IsDefined(LastBackupOn)) + { + writer.WritePropertyName("lastBackupTime"u8); + writer.WriteStringValue(LastBackupOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(MostRecentLinkError)) + { + writer.WritePropertyName("mostRecentLinkError"u8); + writer.WriteStringValue(MostRecentLinkError); + } + if (options.Format != "W" && Optional.IsDefined(PartnerAuthCertValidity)) + { + writer.WritePropertyName("partnerAuthCertValidity"u8); + writer.WriteObjectValue(PartnerAuthCertValidity, options); + } + if (options.Format != "W" && Optional.IsDefined(InstanceSendReplicationLagSeconds)) + { + writer.WritePropertyName("instanceSendReplicationLagSeconds"u8); + writer.WriteNumberValue(InstanceSendReplicationLagSeconds.Value); + } + if (options.Format != "W" && Optional.IsDefined(InstanceRedoReplicationLagSeconds)) + { + writer.WritePropertyName("instanceRedoReplicationLagSeconds"u8); + writer.WriteNumberValue(InstanceRedoReplicationLagSeconds.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DistributedAvailabilityGroupDatabase 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(DistributedAvailabilityGroupDatabase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDistributedAvailabilityGroupDatabase(document.RootElement, options); + } + + internal static DistributedAvailabilityGroupDatabase DeserializeDistributedAvailabilityGroupDatabase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string databaseName = default; + Guid? instanceReplicaId = default; + Guid? partnerReplicaId = default; + string replicaState = default; + string seedingProgress = default; + ReplicaSynchronizationHealth? synchronizationHealth = default; + ReplicaConnectedState? connectedState = default; + string lastReceivedLsn = default; + DateTimeOffset? lastReceivedTime = default; + string lastSentLsn = default; + DateTimeOffset? lastSentTime = default; + string lastCommitLsn = default; + DateTimeOffset? lastCommitTime = default; + string lastHardenedLsn = default; + DateTimeOffset? lastHardenedTime = default; + string lastBackupLsn = default; + DateTimeOffset? lastBackupTime = default; + string mostRecentLinkError = default; + CertificateInfo partnerAuthCertValidity = default; + int? instanceSendReplicationLagSeconds = default; + int? instanceRedoReplicationLagSeconds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("databaseName"u8)) + { + databaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceReplicaId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceReplicaId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("partnerReplicaId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerReplicaId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("replicaState"u8)) + { + replicaState = property.Value.GetString(); + continue; + } + if (property.NameEquals("seedingProgress"u8)) + { + seedingProgress = property.Value.GetString(); + continue; + } + if (property.NameEquals("synchronizationHealth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + synchronizationHealth = new ReplicaSynchronizationHealth(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectedState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectedState = new ReplicaConnectedState(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastReceivedLsn"u8)) + { + lastReceivedLsn = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastReceivedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastReceivedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSentLsn"u8)) + { + lastSentLsn = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSentTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSentTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastCommitLsn"u8)) + { + lastCommitLsn = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastCommitTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastCommitTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastHardenedLsn"u8)) + { + lastHardenedLsn = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastHardenedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastHardenedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastBackupLsn"u8)) + { + lastBackupLsn = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastBackupTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastBackupTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("mostRecentLinkError"u8)) + { + mostRecentLinkError = property.Value.GetString(); + continue; + } + if (property.NameEquals("partnerAuthCertValidity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerAuthCertValidity = CertificateInfo.DeserializeCertificateInfo(property.Value, options); + continue; + } + if (property.NameEquals("instanceSendReplicationLagSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceSendReplicationLagSeconds = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("instanceRedoReplicationLagSeconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceRedoReplicationLagSeconds = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DistributedAvailabilityGroupDatabase( + databaseName, + instanceReplicaId, + partnerReplicaId, + replicaState, + seedingProgress, + synchronizationHealth, + connectedState, + lastReceivedLsn, + lastReceivedTime, + lastSentLsn, + lastSentTime, + lastCommitLsn, + lastCommitTime, + lastHardenedLsn, + lastHardenedTime, + lastBackupLsn, + lastBackupTime, + mostRecentLinkError, + partnerAuthCertValidity, + instanceSendReplicationLagSeconds, + instanceRedoReplicationLagSeconds, + 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(DatabaseName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" databaseName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DatabaseName)) + { + builder.Append(" databaseName: "); + if (DatabaseName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DatabaseName}'''"); + } + else + { + builder.AppendLine($"'{DatabaseName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceReplicaId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceReplicaId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceReplicaId)) + { + builder.Append(" instanceReplicaId: "); + builder.AppendLine($"'{InstanceReplicaId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerReplicaId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" partnerReplicaId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PartnerReplicaId)) + { + builder.Append(" partnerReplicaId: "); + builder.AppendLine($"'{PartnerReplicaId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReplicaState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" replicaState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ReplicaState)) + { + builder.Append(" replicaState: "); + if (ReplicaState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ReplicaState}'''"); + } + else + { + builder.AppendLine($"'{ReplicaState}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SeedingProgress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" seedingProgress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SeedingProgress)) + { + builder.Append(" seedingProgress: "); + if (SeedingProgress.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SeedingProgress}'''"); + } + else + { + builder.AppendLine($"'{SeedingProgress}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SynchronizationHealth), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" synchronizationHealth: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SynchronizationHealth)) + { + builder.Append(" synchronizationHealth: "); + builder.AppendLine($"'{SynchronizationHealth.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectedState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" connectedState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConnectedState)) + { + builder.Append(" connectedState: "); + builder.AppendLine($"'{ConnectedState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastReceivedLsn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastReceivedLsn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastReceivedLsn)) + { + builder.Append(" lastReceivedLsn: "); + if (LastReceivedLsn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastReceivedLsn}'''"); + } + else + { + builder.AppendLine($"'{LastReceivedLsn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastReceivedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastReceivedTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastReceivedOn)) + { + builder.Append(" lastReceivedTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastReceivedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastSentLsn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastSentLsn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastSentLsn)) + { + builder.Append(" lastSentLsn: "); + if (LastSentLsn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastSentLsn}'''"); + } + else + { + builder.AppendLine($"'{LastSentLsn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastSentOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastSentTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastSentOn)) + { + builder.Append(" lastSentTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastSentOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastCommitLsn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastCommitLsn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastCommitLsn)) + { + builder.Append(" lastCommitLsn: "); + if (LastCommitLsn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastCommitLsn}'''"); + } + else + { + builder.AppendLine($"'{LastCommitLsn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastCommitOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastCommitTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastCommitOn)) + { + builder.Append(" lastCommitTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastCommitOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastHardenedLsn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastHardenedLsn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastHardenedLsn)) + { + builder.Append(" lastHardenedLsn: "); + if (LastHardenedLsn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastHardenedLsn}'''"); + } + else + { + builder.AppendLine($"'{LastHardenedLsn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastHardenedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastHardenedTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastHardenedOn)) + { + builder.Append(" lastHardenedTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastHardenedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastBackupLsn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastBackupLsn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastBackupLsn)) + { + builder.Append(" lastBackupLsn: "); + if (LastBackupLsn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LastBackupLsn}'''"); + } + else + { + builder.AppendLine($"'{LastBackupLsn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastBackupOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastBackupTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastBackupOn)) + { + builder.Append(" lastBackupTime: "); + var formattedDateTimeString = TypeFormatters.ToString(LastBackupOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MostRecentLinkError), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mostRecentLinkError: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MostRecentLinkError)) + { + builder.Append(" mostRecentLinkError: "); + if (MostRecentLinkError.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MostRecentLinkError}'''"); + } + else + { + builder.AppendLine($"'{MostRecentLinkError}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PartnerAuthCertValidity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" partnerAuthCertValidity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PartnerAuthCertValidity)) + { + builder.Append(" partnerAuthCertValidity: "); + BicepSerializationHelpers.AppendChildObject(builder, PartnerAuthCertValidity, options, 2, false, " partnerAuthCertValidity: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceSendReplicationLagSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceSendReplicationLagSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceSendReplicationLagSeconds)) + { + builder.Append(" instanceSendReplicationLagSeconds: "); + builder.AppendLine($"{InstanceSendReplicationLagSeconds.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceRedoReplicationLagSeconds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceRedoReplicationLagSeconds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceRedoReplicationLagSeconds)) + { + builder.Append(" instanceRedoReplicationLagSeconds: "); + builder.AppendLine($"{InstanceRedoReplicationLagSeconds.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(DistributedAvailabilityGroupDatabase)} does not support writing '{options.Format}' format."); + } + } + + DistributedAvailabilityGroupDatabase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDistributedAvailabilityGroupDatabase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DistributedAvailabilityGroupDatabase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.cs new file mode 100644 index 000000000000..c64216736fc6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupDatabase.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Database specific information. + public partial class DistributedAvailabilityGroupDatabase + { + /// + /// 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 DistributedAvailabilityGroupDatabase() + { + } + + /// Initializes a new instance of . + /// The name of the database in link. + /// Managed instance replica id. + /// SQL server replica id. + /// Current link state. + /// Seeding progress. + /// Link health state. + /// Link connected state. + /// Last received LSN. + /// Last received LSN time. + /// Last sent LSN. + /// Last sent LSN time. + /// Last commit LSN. + /// Last commit LSN time. + /// Last hardened LSN. + /// Last hardened LSN time. + /// Last backup LSN. + /// Last backup LSN time. + /// The most recent link connection error description. + /// SQL server certificate validity. + /// Replication lag when Managed Instance link side is primary. + /// Redo lag when Managed Instance link side is primary. + /// Keeps track of any properties unknown to the library. + internal DistributedAvailabilityGroupDatabase(string databaseName, Guid? instanceReplicaId, Guid? partnerReplicaId, string replicaState, string seedingProgress, ReplicaSynchronizationHealth? synchronizationHealth, ReplicaConnectedState? connectedState, string lastReceivedLsn, DateTimeOffset? lastReceivedOn, string lastSentLsn, DateTimeOffset? lastSentOn, string lastCommitLsn, DateTimeOffset? lastCommitOn, string lastHardenedLsn, DateTimeOffset? lastHardenedOn, string lastBackupLsn, DateTimeOffset? lastBackupOn, string mostRecentLinkError, CertificateInfo partnerAuthCertValidity, int? instanceSendReplicationLagSeconds, int? instanceRedoReplicationLagSeconds, IDictionary serializedAdditionalRawData) + { + DatabaseName = databaseName; + InstanceReplicaId = instanceReplicaId; + PartnerReplicaId = partnerReplicaId; + ReplicaState = replicaState; + SeedingProgress = seedingProgress; + SynchronizationHealth = synchronizationHealth; + ConnectedState = connectedState; + LastReceivedLsn = lastReceivedLsn; + LastReceivedOn = lastReceivedOn; + LastSentLsn = lastSentLsn; + LastSentOn = lastSentOn; + LastCommitLsn = lastCommitLsn; + LastCommitOn = lastCommitOn; + LastHardenedLsn = lastHardenedLsn; + LastHardenedOn = lastHardenedOn; + LastBackupLsn = lastBackupLsn; + LastBackupOn = lastBackupOn; + MostRecentLinkError = mostRecentLinkError; + PartnerAuthCertValidity = partnerAuthCertValidity; + InstanceSendReplicationLagSeconds = instanceSendReplicationLagSeconds; + InstanceRedoReplicationLagSeconds = instanceRedoReplicationLagSeconds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the database in link. + [WirePath("databaseName")] + public string DatabaseName { get; set; } + /// Managed instance replica id. + [WirePath("instanceReplicaId")] + public Guid? InstanceReplicaId { get; } + /// SQL server replica id. + [WirePath("partnerReplicaId")] + public Guid? PartnerReplicaId { get; } + /// Current link state. + [WirePath("replicaState")] + public string ReplicaState { get; } + /// Seeding progress. + [WirePath("seedingProgress")] + public string SeedingProgress { get; } + /// Link health state. + [WirePath("synchronizationHealth")] + public ReplicaSynchronizationHealth? SynchronizationHealth { get; } + /// Link connected state. + [WirePath("connectedState")] + public ReplicaConnectedState? ConnectedState { get; } + /// Last received LSN. + [WirePath("lastReceivedLsn")] + public string LastReceivedLsn { get; } + /// Last received LSN time. + [WirePath("lastReceivedTime")] + public DateTimeOffset? LastReceivedOn { get; } + /// Last sent LSN. + [WirePath("lastSentLsn")] + public string LastSentLsn { get; } + /// Last sent LSN time. + [WirePath("lastSentTime")] + public DateTimeOffset? LastSentOn { get; } + /// Last commit LSN. + [WirePath("lastCommitLsn")] + public string LastCommitLsn { get; } + /// Last commit LSN time. + [WirePath("lastCommitTime")] + public DateTimeOffset? LastCommitOn { get; } + /// Last hardened LSN. + [WirePath("lastHardenedLsn")] + public string LastHardenedLsn { get; } + /// Last hardened LSN time. + [WirePath("lastHardenedTime")] + public DateTimeOffset? LastHardenedOn { get; } + /// Last backup LSN. + [WirePath("lastBackupLsn")] + public string LastBackupLsn { get; } + /// Last backup LSN time. + [WirePath("lastBackupTime")] + public DateTimeOffset? LastBackupOn { get; } + /// The most recent link connection error description. + [WirePath("mostRecentLinkError")] + public string MostRecentLinkError { get; } + /// SQL server certificate validity. + [WirePath("partnerAuthCertValidity")] + public CertificateInfo PartnerAuthCertValidity { get; } + /// Replication lag when Managed Instance link side is primary. + [WirePath("instanceSendReplicationLagSeconds")] + public int? InstanceSendReplicationLagSeconds { get; } + /// Redo lag when Managed Instance link side is primary. + [WirePath("instanceRedoReplicationLagSeconds")] + public int? InstanceRedoReplicationLagSeconds { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupReplicationMode.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupReplicationMode.cs deleted file mode 100644 index 6938a98b3bc6..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupReplicationMode.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.Sql.Models -{ - /// The replication mode of a distributed availability group. Parameter will be ignored during link creation. - public readonly partial struct DistributedAvailabilityGroupReplicationMode : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public DistributedAvailabilityGroupReplicationMode(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string AsyncValue = "Async"; - private const string SyncValue = "Sync"; - - /// Async. - public static DistributedAvailabilityGroupReplicationMode Async { get; } = new DistributedAvailabilityGroupReplicationMode(AsyncValue); - /// Sync. - public static DistributedAvailabilityGroupReplicationMode Sync { get; } = new DistributedAvailabilityGroupReplicationMode(SyncValue); - /// Determines if two values are the same. - public static bool operator ==(DistributedAvailabilityGroupReplicationMode left, DistributedAvailabilityGroupReplicationMode right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(DistributedAvailabilityGroupReplicationMode left, DistributedAvailabilityGroupReplicationMode right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator DistributedAvailabilityGroupReplicationMode(string value) => new DistributedAvailabilityGroupReplicationMode(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is DistributedAvailabilityGroupReplicationMode other && Equals(other); - /// - public bool Equals(DistributedAvailabilityGroupReplicationMode 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.Serialization.cs new file mode 100644 index 000000000000..b11223651a7a --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.Serialization.cs @@ -0,0 +1,134 @@ +// 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.Sql.Models +{ + public partial class DistributedAvailabilityGroupSetRole : 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(DistributedAvailabilityGroupSetRole)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("instanceRole"u8); + writer.WriteStringValue(InstanceRole.ToString()); + writer.WritePropertyName("roleChangeType"u8); + writer.WriteStringValue(RoleChangeType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DistributedAvailabilityGroupSetRole 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(DistributedAvailabilityGroupSetRole)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDistributedAvailabilityGroupSetRole(document.RootElement, options); + } + + internal static DistributedAvailabilityGroupSetRole DeserializeDistributedAvailabilityGroupSetRole(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InstanceRole instanceRole = default; + RoleChangeType roleChangeType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceRole"u8)) + { + instanceRole = new InstanceRole(property.Value.GetString()); + continue; + } + if (property.NameEquals("roleChangeType"u8)) + { + roleChangeType = new RoleChangeType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DistributedAvailabilityGroupSetRole(instanceRole, roleChangeType, 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(DistributedAvailabilityGroupSetRole)} does not support writing '{options.Format}' format."); + } + } + + DistributedAvailabilityGroupSetRole IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDistributedAvailabilityGroupSetRole(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DistributedAvailabilityGroupSetRole)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.cs new file mode 100644 index 000000000000..88f071912cc1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupSetRole.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Distributed availability group failover request. + public partial class DistributedAvailabilityGroupSetRole + { + /// + /// 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 . + /// New role of managed instance in a distributed availability group, can be Primary or Secondary. + /// The type of the role change, can be Planned or Forced. + public DistributedAvailabilityGroupSetRole(InstanceRole instanceRole, RoleChangeType roleChangeType) + { + InstanceRole = instanceRole; + RoleChangeType = roleChangeType; + } + + /// Initializes a new instance of . + /// New role of managed instance in a distributed availability group, can be Primary or Secondary. + /// The type of the role change, can be Planned or Forced. + /// Keeps track of any properties unknown to the library. + internal DistributedAvailabilityGroupSetRole(InstanceRole instanceRole, RoleChangeType roleChangeType, IDictionary serializedAdditionalRawData) + { + InstanceRole = instanceRole; + RoleChangeType = roleChangeType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DistributedAvailabilityGroupSetRole() + { + } + + /// New role of managed instance in a distributed availability group, can be Primary or Secondary. + [WirePath("instanceRole")] + public InstanceRole InstanceRole { get; } + /// The type of the role change, can be Planned or Forced. + [WirePath("roleChangeType")] + public RoleChangeType RoleChangeType { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.Serialization.cs new file mode 100644 index 000000000000..e7cc4f89b647 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.Serialization.cs @@ -0,0 +1,126 @@ +// 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.Sql.Models +{ + public partial class DistributedAvailabilityGroupsFailoverContent : 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(DistributedAvailabilityGroupsFailoverContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("failoverType"u8); + writer.WriteStringValue(FailoverType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DistributedAvailabilityGroupsFailoverContent 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(DistributedAvailabilityGroupsFailoverContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDistributedAvailabilityGroupsFailoverContent(document.RootElement, options); + } + + internal static DistributedAvailabilityGroupsFailoverContent DeserializeDistributedAvailabilityGroupsFailoverContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FailoverType failoverType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("failoverType"u8)) + { + failoverType = new FailoverType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DistributedAvailabilityGroupsFailoverContent(failoverType, 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(DistributedAvailabilityGroupsFailoverContent)} does not support writing '{options.Format}' format."); + } + } + + DistributedAvailabilityGroupsFailoverContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDistributedAvailabilityGroupsFailoverContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DistributedAvailabilityGroupsFailoverContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.cs new file mode 100644 index 000000000000..b1305eb1e21e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/DistributedAvailabilityGroupsFailoverContent.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Sql.Models +{ + /// Distributed availability group failover. + public partial class DistributedAvailabilityGroupsFailoverContent + { + /// + /// 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 failover type, can be ForcedAllowDataLoss or Planned. + public DistributedAvailabilityGroupsFailoverContent(FailoverType failoverType) + { + FailoverType = failoverType; + } + + /// Initializes a new instance of . + /// The failover type, can be ForcedAllowDataLoss or Planned. + /// Keeps track of any properties unknown to the library. + internal DistributedAvailabilityGroupsFailoverContent(FailoverType failoverType, IDictionary serializedAdditionalRawData) + { + FailoverType = failoverType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DistributedAvailabilityGroupsFailoverContent() + { + } + + /// The failover type, can be ForcedAllowDataLoss or Planned. + [WirePath("failoverType")] + public FailoverType FailoverType { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverModeType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverModeType.cs new file mode 100644 index 000000000000..0ca6d4abf81e --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverModeType.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.Sql.Models +{ + /// The link failover mode - can be Manual if intended to be used for two-way failover with a supported SQL Server, or None for one-way failover to Azure. + public readonly partial struct FailoverModeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FailoverModeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ManualValue = "Manual"; + + /// None. + public static FailoverModeType None { get; } = new FailoverModeType(NoneValue); + /// Manual. + public static FailoverModeType Manual { get; } = new FailoverModeType(ManualValue); + /// Determines if two values are the same. + public static bool operator ==(FailoverModeType left, FailoverModeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FailoverModeType left, FailoverModeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FailoverModeType(string value) => new FailoverModeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FailoverModeType other && Equals(other); + /// + public bool Equals(FailoverModeType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverType.cs new file mode 100644 index 000000000000..6de7d42aa64f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FailoverType.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.Sql.Models +{ + /// The failover type, can be ForcedAllowDataLoss or Planned. + public readonly partial struct FailoverType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FailoverType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ForcedAllowDataLossValue = "ForcedAllowDataLoss"; + private const string PlannedValue = "Planned"; + + /// ForcedAllowDataLoss. + public static FailoverType ForcedAllowDataLoss { get; } = new FailoverType(ForcedAllowDataLossValue); + /// Planned. + public static FailoverType Planned { get; } = new FailoverType(PlannedValue); + /// Determines if two values are the same. + public static bool operator ==(FailoverType left, FailoverType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FailoverType left, FailoverType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FailoverType(string value) => new FailoverType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FailoverType other && Equals(other); + /// + public bool Equals(FailoverType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FreemiumType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FreemiumType.cs new file mode 100644 index 000000000000..7c15f87c25b6 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/FreemiumType.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.Sql.Models +{ + /// Weather or not Managed Instance is freemium. + public readonly partial struct FreemiumType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FreemiumType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RegularValue = "Regular"; + private const string FreemiumValue = "Freemium"; + + /// Regular. + public static FreemiumType Regular { get; } = new FreemiumType(RegularValue); + /// Freemium. + public static FreemiumType Freemium { get; } = new FreemiumType(FreemiumValue); + /// Determines if two values are the same. + public static bool operator ==(FreemiumType left, FreemiumType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FreemiumType left, FreemiumType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator FreemiumType(string value) => new FreemiumType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FreemiumType other && Equals(other); + /// + public bool Equals(FreemiumType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsage.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsage.cs new file mode 100644 index 000000000000..787e7a24ebe1 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsage.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.Sql.Models +{ + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + public readonly partial struct HybridSecondaryUsage : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridSecondaryUsage(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string PassiveValue = "Passive"; + + /// Active. + public static HybridSecondaryUsage Active { get; } = new HybridSecondaryUsage(ActiveValue); + /// Passive. + public static HybridSecondaryUsage Passive { get; } = new HybridSecondaryUsage(PassiveValue); + /// Determines if two values are the same. + public static bool operator ==(HybridSecondaryUsage left, HybridSecondaryUsage right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridSecondaryUsage left, HybridSecondaryUsage right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HybridSecondaryUsage(string value) => new HybridSecondaryUsage(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridSecondaryUsage other && Equals(other); + /// + public bool Equals(HybridSecondaryUsage 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsageDetected.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsageDetected.cs new file mode 100644 index 000000000000..5dba9bfa0e77 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/HybridSecondaryUsageDetected.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.Sql.Models +{ + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). + public readonly partial struct HybridSecondaryUsageDetected : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public HybridSecondaryUsageDetected(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string PassiveValue = "Passive"; + + /// Active. + public static HybridSecondaryUsageDetected Active { get; } = new HybridSecondaryUsageDetected(ActiveValue); + /// Passive. + public static HybridSecondaryUsageDetected Passive { get; } = new HybridSecondaryUsageDetected(PassiveValue); + /// Determines if two values are the same. + public static bool operator ==(HybridSecondaryUsageDetected left, HybridSecondaryUsageDetected right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(HybridSecondaryUsageDetected left, HybridSecondaryUsageDetected right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator HybridSecondaryUsageDetected(string value) => new HybridSecondaryUsageDetected(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is HybridSecondaryUsageDetected other && Equals(other); + /// + public bool Equals(HybridSecondaryUsageDetected 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstanceRole.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstanceRole.cs new file mode 100644 index 000000000000..47134adf7a2f --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/InstanceRole.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.Sql.Models +{ + /// New role of managed instance in a distributed availability group, can be Primary or Secondary. + public readonly partial struct InstanceRole : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public InstanceRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryValue = "Primary"; + private const string SecondaryValue = "Secondary"; + + /// Primary. + public static InstanceRole Primary { get; } = new InstanceRole(PrimaryValue); + /// Secondary. + public static InstanceRole Secondary { get; } = new InstanceRole(SecondaryValue); + /// Determines if two values are the same. + public static bool operator ==(InstanceRole left, InstanceRole right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(InstanceRole left, InstanceRole right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator InstanceRole(string value) => new InstanceRole(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is InstanceRole other && Equals(other); + /// + public bool Equals(InstanceRole 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LinkRole.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LinkRole.cs new file mode 100644 index 000000000000..ea6e50792f17 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/LinkRole.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.Sql.Models +{ + /// SQL server side link role. + public readonly partial struct LinkRole : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LinkRole(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrimaryValue = "Primary"; + private const string SecondaryValue = "Secondary"; + + /// Primary. + public static LinkRole Primary { get; } = new LinkRole(PrimaryValue); + /// Secondary. + public static LinkRole Secondary { get; } = new LinkRole(SecondaryValue); + /// Determines if two values are the same. + public static bool operator ==(LinkRole left, LinkRole right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LinkRole left, LinkRole right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator LinkRole(string value) => new LinkRole(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LinkRole other && Equals(other); + /// + public bool Equals(LinkRole 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDatabaseFormat.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDatabaseFormat.cs new file mode 100644 index 000000000000..ed9c1b652eaa --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstanceDatabaseFormat.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.Sql.Models +{ + /// Specifies the internal format of instance databases specific to the SQL engine version. + public readonly partial struct ManagedInstanceDatabaseFormat : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedInstanceDatabaseFormat(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AlwaysUpToDateValue = "AlwaysUpToDate"; + private const string SqlServer2022Value = "SQLServer2022"; + + /// AlwaysUpToDate. + public static ManagedInstanceDatabaseFormat AlwaysUpToDate { get; } = new ManagedInstanceDatabaseFormat(AlwaysUpToDateValue); + /// SQLServer2022. + public static ManagedInstanceDatabaseFormat SqlServer2022 { get; } = new ManagedInstanceDatabaseFormat(SqlServer2022Value); + /// Determines if two values are the same. + public static bool operator ==(ManagedInstanceDatabaseFormat left, ManagedInstanceDatabaseFormat right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedInstanceDatabaseFormat left, ManagedInstanceDatabaseFormat right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagedInstanceDatabaseFormat(string value) => new ManagedInstanceDatabaseFormat(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedInstanceDatabaseFormat other && Equals(other); + /// + public bool Equals(ManagedInstanceDatabaseFormat 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs index 8491806f9999..29e9a46414e7 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.Serialization.cs @@ -74,6 +74,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("fullyQualifiedDomainName"u8); writer.WriteStringValue(FullyQualifiedDomainName); } + if (Optional.IsDefined(IsGeneralPurposeV2)) + { + writer.WritePropertyName("isGeneralPurposeV2"u8); + writer.WriteBooleanValue(IsGeneralPurposeV2.Value); + } if (Optional.IsDefined(AdministratorLogin)) { writer.WritePropertyName("administratorLogin"u8); @@ -99,6 +104,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("licenseType"u8); writer.WriteStringValue(LicenseType.Value.ToString()); } + if (Optional.IsDefined(HybridSecondaryUsage)) + { + writer.WritePropertyName("hybridSecondaryUsage"u8); + writer.WriteStringValue(HybridSecondaryUsage.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(HybridSecondaryUsageDetected)) + { + writer.WritePropertyName("hybridSecondaryUsageDetected"u8); + writer.WriteStringValue(HybridSecondaryUsageDetected.Value.ToString()); + } if (Optional.IsDefined(VCores)) { writer.WritePropertyName("vCores"u8); @@ -109,6 +124,16 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("storageSizeInGB"u8); writer.WriteNumberValue(StorageSizeInGB.Value); } + if (Optional.IsDefined(StorageIOps)) + { + writer.WritePropertyName("storageIOps"u8); + writer.WriteNumberValue(StorageIOps.Value); + } + if (Optional.IsDefined(StorageThroughputMBps)) + { + writer.WritePropertyName("storageThroughputMBps"u8); + writer.WriteNumberValue(StorageThroughputMBps.Value); + } if (Optional.IsDefined(Collation)) { writer.WritePropertyName("collation"u8); @@ -209,6 +234,36 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("servicePrincipal"u8); writer.WriteObjectValue(ServicePrincipal, options); } + if (options.Format != "W" && Optional.IsDefined(VirtualClusterId)) + { + writer.WritePropertyName("virtualClusterId"u8); + writer.WriteStringValue(VirtualClusterId); + } + if (options.Format != "W" && Optional.IsDefined(ExternalGovernanceStatus)) + { + writer.WritePropertyName("externalGovernanceStatus"u8); + writer.WriteStringValue(ExternalGovernanceStatus.Value.ToString()); + } + if (Optional.IsDefined(PricingModel)) + { + writer.WritePropertyName("pricingModel"u8); + writer.WriteStringValue(PricingModel.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreateOn)) + { + writer.WritePropertyName("createTime"u8); + writer.WriteStringValue(CreateOn.Value, "O"); + } + if (Optional.IsDefined(AuthenticationMetadata)) + { + writer.WritePropertyName("authenticationMetadata"u8); + writer.WriteStringValue(AuthenticationMetadata.Value.ToString()); + } + if (Optional.IsDefined(DatabaseFormat)) + { + writer.WritePropertyName("databaseFormat"u8); + writer.WriteStringValue(DatabaseFormat.Value.ToString()); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -250,16 +305,21 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement SqlSku sku = default; ManagedServiceIdentity identity = default; IDictionary tags = default; - ManagedInstancePropertiesProvisioningState? provisioningState = default; + JobExecutionProvisioningState? provisioningState = default; ManagedServerCreateMode? managedInstanceCreateMode = default; string fullyQualifiedDomainName = default; + bool? isGeneralPurposeV2 = default; string administratorLogin = default; string administratorLoginPassword = default; ResourceIdentifier subnetId = default; string state = default; ManagedInstanceLicenseType? licenseType = default; + HybridSecondaryUsage? hybridSecondaryUsage = default; + HybridSecondaryUsageDetected? hybridSecondaryUsageDetected = default; int? vCores = default; int? storageSizeInGB = default; + int? storageIOps = default; + int? storageThroughputMBps = default; string collation = default; string dnsZone = default; ResourceIdentifier dnsZonePartner = default; @@ -279,6 +339,12 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement Uri keyId = default; ManagedInstanceExternalAdministrator administrators = default; SqlServicePrincipal servicePrincipal = default; + string virtualClusterId = default; + ExternalGovernanceStatus? externalGovernanceStatus = default; + FreemiumType? pricingModel = default; + DateTimeOffset? createTime = default; + AuthMetadataLookupMode? authenticationMetadata = default; + ManagedInstanceDatabaseFormat? databaseFormat = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -331,7 +397,7 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement { continue; } - provisioningState = new ManagedInstancePropertiesProvisioningState(property0.Value.GetString()); + provisioningState = new JobExecutionProvisioningState(property0.Value.GetString()); continue; } if (property0.NameEquals("managedInstanceCreateMode"u8)) @@ -348,6 +414,15 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement fullyQualifiedDomainName = property0.Value.GetString(); continue; } + if (property0.NameEquals("isGeneralPurposeV2"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isGeneralPurposeV2 = property0.Value.GetBoolean(); + continue; + } if (property0.NameEquals("administratorLogin"u8)) { administratorLogin = property0.Value.GetString(); @@ -381,6 +456,24 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement licenseType = new ManagedInstanceLicenseType(property0.Value.GetString()); continue; } + if (property0.NameEquals("hybridSecondaryUsage"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hybridSecondaryUsage = new HybridSecondaryUsage(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("hybridSecondaryUsageDetected"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hybridSecondaryUsageDetected = new HybridSecondaryUsageDetected(property0.Value.GetString()); + continue; + } if (property0.NameEquals("vCores"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -399,6 +492,24 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement storageSizeInGB = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("storageIOps"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageIOps = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("storageThroughputMBps"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageThroughputMBps = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("collation"u8)) { collation = property0.Value.GetString(); @@ -559,6 +670,56 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement servicePrincipal = SqlServicePrincipal.DeserializeSqlServicePrincipal(property0.Value, options); continue; } + if (property0.NameEquals("virtualClusterId"u8)) + { + virtualClusterId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("externalGovernanceStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + externalGovernanceStatus = new ExternalGovernanceStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("pricingModel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pricingModel = new FreemiumType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("createTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("authenticationMetadata"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authenticationMetadata = new AuthMetadataLookupMode(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("databaseFormat"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + databaseFormat = new ManagedInstanceDatabaseFormat(property0.Value.GetString()); + continue; + } } continue; } @@ -575,13 +736,18 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement provisioningState, managedInstanceCreateMode, fullyQualifiedDomainName, + isGeneralPurposeV2, administratorLogin, administratorLoginPassword, subnetId, state, licenseType, + hybridSecondaryUsage, + hybridSecondaryUsageDetected, vCores, storageSizeInGB, + storageIOps, + storageThroughputMBps, collation, dnsZone, dnsZonePartner, @@ -601,6 +767,12 @@ internal static ManagedInstancePatch DeserializeManagedInstancePatch(JsonElement keyId, administrators, servicePrincipal, + virtualClusterId, + externalGovernanceStatus, + pricingModel, + createTime, + authenticationMetadata, + databaseFormat, serializedAdditionalRawData); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs index 4564590e9977..91fb9b3a22a4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePatch.cs @@ -58,7 +58,7 @@ public ManagedInstancePatch() /// Managed instance sku. /// Managed instance identity. /// Resource tags. - /// + /// Provisioning state of managed instance. /// /// Specifies the mode of database creation. /// @@ -67,13 +67,18 @@ public ManagedInstancePatch() /// Restore: Creates an instance by restoring a set of backups to specific point in time. RestorePointInTime and SourceManagedInstanceId must be specified. /// /// The fully qualified domain name of the managed instance. + /// Whether or not this is a GPv2 variant of General Purpose edition. /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). /// The administrator login password (required for managed instance creation). /// Subnet resource ID for the managed instance. /// The state of the managed instance. /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + /// Storage throughput MBps parameter is not supported in the instance create/update operation. /// Collation of the managed instance. /// The Dns Zone that the managed instance is in. /// The resource id of another managed instance whose DNS zone this managed instance will share after creation. @@ -100,8 +105,14 @@ public ManagedInstancePatch() /// A CMK URI of the key to use for encryption. /// The Azure Active Directory administrator of the instance. This can only be used at instance create time. If used for instance update, it will be ignored or it will result in an error. For updates individual APIs will need to be used. /// The managed instance's service principal. + /// Virtual cluster resource id for the Managed Instance. + /// Status of external governance. + /// Weather or not Managed Instance is freemium. + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + /// The managed instance's authentication metadata lookup mode. + /// Specifies the internal format of instance databases specific to the SQL engine version. /// Keeps track of any properties unknown to the library. - internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDictionary tags, ManagedInstancePropertiesProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, string administratorLogin, string administratorLoginPassword, ResourceIdentifier subnetId, string state, ManagedInstanceLicenseType? licenseType, int? vCores, int? storageSizeInGB, string collation, string dnsZone, ResourceIdentifier managedDnsZonePartner, bool? isPublicDataEndpointEnabled, ResourceIdentifier sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, ResourceIdentifier instancePoolId, ResourceIdentifier maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, SqlBackupStorageRedundancy? currentBackupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy, bool? isZoneRedundant, ResourceIdentifier primaryUserAssignedIdentityId, Uri keyId, ManagedInstanceExternalAdministrator administrators, SqlServicePrincipal servicePrincipal, IDictionary serializedAdditionalRawData) + internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDictionary tags, JobExecutionProvisioningState? provisioningState, ManagedServerCreateMode? managedInstanceCreateMode, string fullyQualifiedDomainName, bool? isGeneralPurposeV2, string administratorLogin, string administratorLoginPassword, ResourceIdentifier subnetId, string state, ManagedInstanceLicenseType? licenseType, HybridSecondaryUsage? hybridSecondaryUsage, HybridSecondaryUsageDetected? hybridSecondaryUsageDetected, int? vCores, int? storageSizeInGB, int? storageIOps, int? storageThroughputMBps, string collation, string dnsZone, ResourceIdentifier managedDnsZonePartner, bool? isPublicDataEndpointEnabled, ResourceIdentifier sourceManagedInstanceId, DateTimeOffset? restorePointInTime, ManagedInstanceProxyOverride? proxyOverride, string timezoneId, ResourceIdentifier instancePoolId, ResourceIdentifier maintenanceConfigurationId, IReadOnlyList privateEndpointConnections, string minimalTlsVersion, SqlBackupStorageRedundancy? currentBackupStorageRedundancy, SqlBackupStorageRedundancy? requestedBackupStorageRedundancy, bool? isZoneRedundant, ResourceIdentifier primaryUserAssignedIdentityId, Uri keyId, ManagedInstanceExternalAdministrator administrators, SqlServicePrincipal servicePrincipal, string virtualClusterId, ExternalGovernanceStatus? externalGovernanceStatus, FreemiumType? pricingModel, DateTimeOffset? createOn, AuthMetadataLookupMode? authenticationMetadata, ManagedInstanceDatabaseFormat? databaseFormat, IDictionary serializedAdditionalRawData) { Sku = sku; Identity = identity; @@ -109,13 +120,18 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict ProvisioningState = provisioningState; ManagedInstanceCreateMode = managedInstanceCreateMode; FullyQualifiedDomainName = fullyQualifiedDomainName; + IsGeneralPurposeV2 = isGeneralPurposeV2; AdministratorLogin = administratorLogin; AdministratorLoginPassword = administratorLoginPassword; SubnetId = subnetId; State = state; LicenseType = licenseType; + HybridSecondaryUsage = hybridSecondaryUsage; + HybridSecondaryUsageDetected = hybridSecondaryUsageDetected; VCores = vCores; StorageSizeInGB = storageSizeInGB; + StorageIOps = storageIOps; + StorageThroughputMBps = storageThroughputMBps; Collation = collation; DnsZone = dnsZone; ManagedDnsZonePartner = managedDnsZonePartner; @@ -135,6 +151,12 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict KeyId = keyId; Administrators = administrators; ServicePrincipal = servicePrincipal; + VirtualClusterId = virtualClusterId; + ExternalGovernanceStatus = externalGovernanceStatus; + PricingModel = pricingModel; + CreateOn = createOn; + AuthenticationMetadata = authenticationMetadata; + DatabaseFormat = databaseFormat; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -147,9 +169,9 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict /// Resource tags. [WirePath("tags")] public IDictionary Tags { get; } - /// Gets the provisioning state. + /// Provisioning state of managed instance. [WirePath("properties.provisioningState")] - public ManagedInstancePropertiesProvisioningState? ProvisioningState { get; } + public JobExecutionProvisioningState? ProvisioningState { get; } /// /// Specifies the mode of database creation. /// @@ -162,6 +184,9 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict /// The fully qualified domain name of the managed instance. [WirePath("properties.fullyQualifiedDomainName")] public string FullyQualifiedDomainName { get; } + /// Whether or not this is a GPv2 variant of General Purpose edition. + [WirePath("properties.isGeneralPurposeV2")] + public bool? IsGeneralPurposeV2 { get; set; } /// Administrator username for the managed instance. Can only be specified when the managed instance is being created (and is required for creation). [WirePath("properties.administratorLogin")] public string AdministratorLogin { get; set; } @@ -177,12 +202,24 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict /// The license type. Possible values are 'LicenseIncluded' (regular price inclusive of a new SQL license) and 'BasePrice' (discounted AHB price for bringing your own SQL licenses). [WirePath("properties.licenseType")] public ManagedInstanceLicenseType? LicenseType { get; set; } + /// Hybrid secondary usage. Possible values are 'Active' (default value) and 'Passive' (customer uses the secondary as Passive DR). + [WirePath("properties.hybridSecondaryUsage")] + public HybridSecondaryUsage? HybridSecondaryUsage { get; set; } + /// Hybrid secondary usage detected. Possible values are 'Active' (customer does not meet the requirements to use the secondary as Passive DR) and 'Passive' (customer meets the requirements to use the secondary as Passive DR). + [WirePath("properties.hybridSecondaryUsageDetected")] + public HybridSecondaryUsageDetected? HybridSecondaryUsageDetected { get; } /// The number of vCores. Allowed values: 8, 16, 24, 32, 40, 64, 80. [WirePath("properties.vCores")] public int? VCores { get; set; } /// Storage size in GB. Minimum value: 32. Maximum value: 16384. Increments of 32 GB allowed only. Maximum value depends on the selected hardware family and number of vCores. [WirePath("properties.storageSizeInGB")] public int? StorageSizeInGB { get; set; } + /// Storage IOps. Minimum value: 300. Maximum value: 80000. Increments of 1 IOps allowed only. Maximum value depends on the selected hardware family and number of vCores. + [WirePath("properties.storageIOps")] + public int? StorageIOps { get; set; } + /// Storage throughput MBps parameter is not supported in the instance create/update operation. + [WirePath("properties.storageThroughputMBps")] + public int? StorageThroughputMBps { get; set; } /// Collation of the managed instance. [WirePath("properties.collation")] public string Collation { get; set; } @@ -247,5 +284,23 @@ internal ManagedInstancePatch(SqlSku sku, ManagedServiceIdentity identity, IDict /// The managed instance's service principal. [WirePath("properties.servicePrincipal")] public SqlServicePrincipal ServicePrincipal { get; set; } + /// Virtual cluster resource id for the Managed Instance. + [WirePath("properties.virtualClusterId")] + public string VirtualClusterId { get; } + /// Status of external governance. + [WirePath("properties.externalGovernanceStatus")] + public ExternalGovernanceStatus? ExternalGovernanceStatus { get; } + /// Weather or not Managed Instance is freemium. + [WirePath("properties.pricingModel")] + public FreemiumType? PricingModel { get; set; } + /// Specifies the point in time (ISO8601 format) of the Managed Instance creation. + [WirePath("properties.createTime")] + public DateTimeOffset? CreateOn { get; } + /// The managed instance's authentication metadata lookup mode. + [WirePath("properties.authenticationMetadata")] + public AuthMetadataLookupMode? AuthenticationMetadata { get; set; } + /// Specifies the internal format of instance databases specific to the SQL engine version. + [WirePath("properties.databaseFormat")] + public ManagedInstanceDatabaseFormat? DatabaseFormat { get; set; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.cs deleted file mode 100644 index 69b071a8428b..000000000000 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ManagedInstancePropertiesProvisioningState.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.ComponentModel; - -namespace Azure.ResourceManager.Sql.Models -{ - /// The ManagedInstancePropertiesProvisioningState. - public readonly partial struct ManagedInstancePropertiesProvisioningState : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public ManagedInstancePropertiesProvisioningState(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string CreatingValue = "Creating"; - private const string DeletingValue = "Deleting"; - private const string UpdatingValue = "Updating"; - private const string UnknownValue = "Unknown"; - private const string SucceededValue = "Succeeded"; - private const string FailedValue = "Failed"; - private const string AcceptedValue = "Accepted"; - private const string CreatedValue = "Created"; - private const string DeletedValue = "Deleted"; - private const string UnrecognizedValue = "Unrecognized"; - private const string RunningValue = "Running"; - private const string CanceledValue = "Canceled"; - private const string NotSpecifiedValue = "NotSpecified"; - private const string RegisteringValue = "Registering"; - private const string TimedOutValue = "TimedOut"; - - /// Creating. - public static ManagedInstancePropertiesProvisioningState Creating { get; } = new ManagedInstancePropertiesProvisioningState(CreatingValue); - /// Deleting. - public static ManagedInstancePropertiesProvisioningState Deleting { get; } = new ManagedInstancePropertiesProvisioningState(DeletingValue); - /// Updating. - public static ManagedInstancePropertiesProvisioningState Updating { get; } = new ManagedInstancePropertiesProvisioningState(UpdatingValue); - /// Unknown. - public static ManagedInstancePropertiesProvisioningState Unknown { get; } = new ManagedInstancePropertiesProvisioningState(UnknownValue); - /// Succeeded. - public static ManagedInstancePropertiesProvisioningState Succeeded { get; } = new ManagedInstancePropertiesProvisioningState(SucceededValue); - /// Failed. - public static ManagedInstancePropertiesProvisioningState Failed { get; } = new ManagedInstancePropertiesProvisioningState(FailedValue); - /// Accepted. - public static ManagedInstancePropertiesProvisioningState Accepted { get; } = new ManagedInstancePropertiesProvisioningState(AcceptedValue); - /// Created. - public static ManagedInstancePropertiesProvisioningState Created { get; } = new ManagedInstancePropertiesProvisioningState(CreatedValue); - /// Deleted. - public static ManagedInstancePropertiesProvisioningState Deleted { get; } = new ManagedInstancePropertiesProvisioningState(DeletedValue); - /// Unrecognized. - public static ManagedInstancePropertiesProvisioningState Unrecognized { get; } = new ManagedInstancePropertiesProvisioningState(UnrecognizedValue); - /// Running. - public static ManagedInstancePropertiesProvisioningState Running { get; } = new ManagedInstancePropertiesProvisioningState(RunningValue); - /// Canceled. - public static ManagedInstancePropertiesProvisioningState Canceled { get; } = new ManagedInstancePropertiesProvisioningState(CanceledValue); - /// NotSpecified. - public static ManagedInstancePropertiesProvisioningState NotSpecified { get; } = new ManagedInstancePropertiesProvisioningState(NotSpecifiedValue); - /// Registering. - public static ManagedInstancePropertiesProvisioningState Registering { get; } = new ManagedInstancePropertiesProvisioningState(RegisteringValue); - /// TimedOut. - public static ManagedInstancePropertiesProvisioningState TimedOut { get; } = new ManagedInstancePropertiesProvisioningState(TimedOutValue); - /// Determines if two values are the same. - public static bool operator ==(ManagedInstancePropertiesProvisioningState left, ManagedInstancePropertiesProvisioningState right) => left.Equals(right); - /// Determines if two values are not the same. - public static bool operator !=(ManagedInstancePropertiesProvisioningState left, ManagedInstancePropertiesProvisioningState right) => !left.Equals(right); - /// Converts a to a . - public static implicit operator ManagedInstancePropertiesProvisioningState(string value) => new ManagedInstancePropertiesProvisioningState(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is ManagedInstancePropertiesProvisioningState other && Equals(other); - /// - public bool Equals(ManagedInstancePropertiesProvisioningState 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.Serialization.cs new file mode 100644 index 000000000000..b252225df642 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.Serialization.cs @@ -0,0 +1,279 @@ +// 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.Sql.Models +{ + public partial class QueryMetricIntervalAutoGenerated : 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(QueryMetricIntervalAutoGenerated)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(IntervalStartTime)) + { + writer.WritePropertyName("intervalStartTime"u8); + writer.WriteStringValue(IntervalStartTime); + } + if (options.Format != "W" && Optional.IsDefined(IntervalType)) + { + writer.WritePropertyName("intervalType"u8); + writer.WriteStringValue(IntervalType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ExecutionCount)) + { + writer.WritePropertyName("executionCount"u8); + writer.WriteNumberValue(ExecutionCount.Value); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + QueryMetricIntervalAutoGenerated 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(QueryMetricIntervalAutoGenerated)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQueryMetricIntervalAutoGenerated(document.RootElement, options); + } + + internal static QueryMetricIntervalAutoGenerated DeserializeQueryMetricIntervalAutoGenerated(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string intervalStartTime = default; + QueryTimeGrainType? intervalType = default; + long? executionCount = default; + IReadOnlyList metrics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("intervalStartTime"u8)) + { + intervalStartTime = property.Value.GetString(); + continue; + } + if (property.NameEquals("intervalType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + intervalType = new QueryTimeGrainType(property.Value.GetString()); + continue; + } + if (property.NameEquals("executionCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + executionCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("metrics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(QueryMetricProperties.DeserializeQueryMetricProperties(item, options)); + } + metrics = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QueryMetricIntervalAutoGenerated(intervalStartTime, intervalType, executionCount, metrics ?? 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(IntervalStartTime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" intervalStartTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IntervalStartTime)) + { + builder.Append(" intervalStartTime: "); + if (IntervalStartTime.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{IntervalStartTime}'''"); + } + else + { + builder.AppendLine($"'{IntervalStartTime}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IntervalType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" intervalType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IntervalType)) + { + builder.Append(" intervalType: "); + builder.AppendLine($"'{IntervalType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExecutionCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" executionCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExecutionCount)) + { + builder.Append(" executionCount: "); + builder.AppendLine($"'{ExecutionCount.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metrics), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metrics: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Metrics)) + { + if (Metrics.Any()) + { + builder.Append(" metrics: "); + builder.AppendLine("["); + foreach (var item in Metrics) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " metrics: "); + } + 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(QueryMetricIntervalAutoGenerated)} does not support writing '{options.Format}' format."); + } + } + + QueryMetricIntervalAutoGenerated IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeQueryMetricIntervalAutoGenerated(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QueryMetricIntervalAutoGenerated)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.cs new file mode 100644 index 000000000000..8bb7b0c61145 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryMetricIntervalAutoGenerated.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.Sql.Models +{ + /// Properties of a query metrics interval. + public partial class QueryMetricIntervalAutoGenerated + { + /// + /// 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 QueryMetricIntervalAutoGenerated() + { + Metrics = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The start time for the metric interval (ISO-8601 format). + /// Interval type (length). + /// Execution count of a query in this interval. + /// List of metric objects for this interval. + /// Keeps track of any properties unknown to the library. + internal QueryMetricIntervalAutoGenerated(string intervalStartTime, QueryTimeGrainType? intervalType, long? executionCount, IReadOnlyList metrics, IDictionary serializedAdditionalRawData) + { + IntervalStartTime = intervalStartTime; + IntervalType = intervalType; + ExecutionCount = executionCount; + Metrics = metrics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The start time for the metric interval (ISO-8601 format). + [WirePath("intervalStartTime")] + public string IntervalStartTime { get; } + /// Interval type (length). + [WirePath("intervalType")] + public QueryTimeGrainType? IntervalType { get; } + /// Execution count of a query in this interval. + [WirePath("executionCount")] + public long? ExecutionCount { get; } + /// List of metric objects for this interval. + [WirePath("metrics")] + public IReadOnlyList Metrics { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs index 22a765179b63..9c94fe5484e4 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.Serialization.cs @@ -107,7 +107,7 @@ internal static QueryStatisticsProperties DeserializeQueryStatisticsProperties(J string queryId = default; string startTime = default; string endTime = default; - IReadOnlyList intervals = default; + IReadOnlyList intervals = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -138,10 +138,10 @@ internal static QueryStatisticsProperties DeserializeQueryStatisticsProperties(J { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(QueryMetricInterval.DeserializeQueryMetricInterval(item, options)); + array.Add(QueryMetricIntervalAutoGenerated.DeserializeQueryMetricIntervalAutoGenerated(item, options)); } intervals = array; continue; @@ -157,7 +157,7 @@ internal static QueryStatisticsProperties DeserializeQueryStatisticsProperties(J queryId, startTime, endTime, - intervals ?? new ChangeTrackingList(), + intervals ?? new ChangeTrackingList(), serializedAdditionalRawData); } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs index a1aa5a92e4ac..47d8cb2d46a2 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/QueryStatisticsProperties.cs @@ -48,7 +48,7 @@ public partial class QueryStatisticsProperties /// Initializes a new instance of . internal QueryStatisticsProperties() { - Intervals = new ChangeTrackingList(); + Intervals = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -58,7 +58,7 @@ internal QueryStatisticsProperties() /// The end time for the metric (ISO-8601 format). /// List of intervals with appropriate metric data. /// Keeps track of any properties unknown to the library. - internal QueryStatisticsProperties(string databaseName, string queryId, string startTime, string endTime, IReadOnlyList intervals, IDictionary serializedAdditionalRawData) + internal QueryStatisticsProperties(string databaseName, string queryId, string startTime, string endTime, IReadOnlyList intervals, IDictionary serializedAdditionalRawData) { DatabaseName = databaseName; QueryId = queryId; @@ -82,6 +82,6 @@ internal QueryStatisticsProperties(string databaseName, string queryId, string s public string EndTime { get; } /// List of intervals with appropriate metric data. [WirePath("intervals")] - public IReadOnlyList Intervals { get; } + public IReadOnlyList Intervals { get; } } } diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.Serialization.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.Serialization.cs new file mode 100644 index 000000000000..1395dcd2a996 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.Serialization.cs @@ -0,0 +1,433 @@ +// 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.Models; + +namespace Azure.ResourceManager.Sql.Models +{ + public partial class RefreshExternalGovernanceStatusOperationResultMI : 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(RefreshExternalGovernanceStatusOperationResultMI)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(RequestId)) + { + writer.WritePropertyName("requestId"u8); + writer.WriteStringValue(RequestId.Value); + } + if (options.Format != "W" && Optional.IsDefined(RequestType)) + { + writer.WritePropertyName("requestType"u8); + writer.WriteStringValue(RequestType); + } + if (options.Format != "W" && Optional.IsDefined(QueuedTime)) + { + writer.WritePropertyName("queuedTime"u8); + writer.WriteStringValue(QueuedTime); + } + if (options.Format != "W" && Optional.IsDefined(ManagedInstanceName)) + { + writer.WritePropertyName("managedInstanceName"u8); + writer.WriteStringValue(ManagedInstanceName); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (options.Format != "W" && Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + writer.WriteEndObject(); + } + + RefreshExternalGovernanceStatusOperationResultMI 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(RefreshExternalGovernanceStatusOperationResultMI)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRefreshExternalGovernanceStatusOperationResultMI(document.RootElement, options); + } + + internal static RefreshExternalGovernanceStatusOperationResultMI DeserializeRefreshExternalGovernanceStatusOperationResultMI(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; + Guid? requestId = default; + string requestType = default; + string queuedTime = default; + string managedInstanceName = default; + string status = default; + string errorMessage = 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("requestId"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + requestId = property0.Value.GetGuid(); + continue; + } + if (property0.NameEquals("requestType"u8)) + { + requestType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("queuedTime"u8)) + { + queuedTime = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("managedInstanceName"u8)) + { + managedInstanceName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status"u8)) + { + status = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("errorMessage"u8)) + { + errorMessage = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RefreshExternalGovernanceStatusOperationResultMI( + id, + name, + type, + systemData, + requestId, + requestType, + queuedTime, + managedInstanceName, + status, + errorMessage, + 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(RequestId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestId)) + { + builder.Append(" requestId: "); + builder.AppendLine($"'{RequestId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RequestType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" requestType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RequestType)) + { + builder.Append(" requestType: "); + if (RequestType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RequestType}'''"); + } + else + { + builder.AppendLine($"'{RequestType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueuedTime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" queuedTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QueuedTime)) + { + builder.Append(" queuedTime: "); + if (QueuedTime.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{QueuedTime}'''"); + } + else + { + builder.AppendLine($"'{QueuedTime}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ManagedInstanceName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" managedInstanceName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ManagedInstanceName)) + { + builder.Append(" managedInstanceName: "); + if (ManagedInstanceName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ManagedInstanceName}'''"); + } + else + { + builder.AppendLine($"'{ManagedInstanceName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ErrorMessage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" errorMessage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ErrorMessage)) + { + builder.Append(" errorMessage: "); + if (ErrorMessage.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ErrorMessage}'''"); + } + else + { + builder.AppendLine($"'{ErrorMessage}'"); + } + } + } + + 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(RefreshExternalGovernanceStatusOperationResultMI)} does not support writing '{options.Format}' format."); + } + } + + RefreshExternalGovernanceStatusOperationResultMI IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRefreshExternalGovernanceStatusOperationResultMI(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RefreshExternalGovernanceStatusOperationResultMI)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.cs new file mode 100644 index 000000000000..79a5ba84b6bc --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RefreshExternalGovernanceStatusOperationResultMI.cs @@ -0,0 +1,97 @@ +// 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.Sql.Models +{ + /// An RefreshExternalGovernanceStatus operation result resource. + public partial class RefreshExternalGovernanceStatusOperationResultMI : 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 RefreshExternalGovernanceStatusOperationResultMI() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Request Id. + /// Request type. + /// Queued time. + /// Managed instance name. + /// Operation status. + /// Error message. + /// Keeps track of any properties unknown to the library. + internal RefreshExternalGovernanceStatusOperationResultMI(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? requestId, string requestType, string queuedTime, string managedInstanceName, string status, string errorMessage, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + RequestId = requestId; + RequestType = requestType; + QueuedTime = queuedTime; + ManagedInstanceName = managedInstanceName; + Status = status; + ErrorMessage = errorMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Request Id. + [WirePath("properties.requestId")] + public Guid? RequestId { get; } + /// Request type. + [WirePath("properties.requestType")] + public string RequestType { get; } + /// Queued time. + [WirePath("properties.queuedTime")] + public string QueuedTime { get; } + /// Managed instance name. + [WirePath("properties.managedInstanceName")] + public string ManagedInstanceName { get; } + /// Operation status. + [WirePath("properties.status")] + public string Status { get; } + /// Error message. + [WirePath("properties.errorMessage")] + public string ErrorMessage { get; } + } +} diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaConnectedState.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaConnectedState.cs new file mode 100644 index 000000000000..c3cfbea65211 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaConnectedState.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.Sql.Models +{ + /// Link connected state. + public readonly partial struct ReplicaConnectedState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReplicaConnectedState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisconnectedValue = "DISCONNECTED"; + private const string ConnectedValue = "CONNECTED"; + + /// DISCONNECTED. + public static ReplicaConnectedState Disconnected { get; } = new ReplicaConnectedState(DisconnectedValue); + /// CONNECTED. + public static ReplicaConnectedState Connected { get; } = new ReplicaConnectedState(ConnectedValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicaConnectedState left, ReplicaConnectedState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicaConnectedState left, ReplicaConnectedState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ReplicaConnectedState(string value) => new ReplicaConnectedState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicaConnectedState other && Equals(other); + /// + public bool Equals(ReplicaConnectedState 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaSynchronizationHealth.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaSynchronizationHealth.cs new file mode 100644 index 000000000000..f3aba9b9fd27 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicaSynchronizationHealth.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.Sql.Models +{ + /// Link health state. + public readonly partial struct ReplicaSynchronizationHealth : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReplicaSynchronizationHealth(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NOTHealthyValue = "NOT_HEALTHY"; + private const string PartiallyHealthyValue = "PARTIALLY_HEALTHY"; + private const string HealthyValue = "HEALTHY"; + + /// NOT_HEALTHY. + public static ReplicaSynchronizationHealth NOTHealthy { get; } = new ReplicaSynchronizationHealth(NOTHealthyValue); + /// PARTIALLY_HEALTHY. + public static ReplicaSynchronizationHealth PartiallyHealthy { get; } = new ReplicaSynchronizationHealth(PartiallyHealthyValue); + /// HEALTHY. + public static ReplicaSynchronizationHealth Healthy { get; } = new ReplicaSynchronizationHealth(HealthyValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicaSynchronizationHealth left, ReplicaSynchronizationHealth right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicaSynchronizationHealth left, ReplicaSynchronizationHealth right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ReplicaSynchronizationHealth(string value) => new ReplicaSynchronizationHealth(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicaSynchronizationHealth other && Equals(other); + /// + public bool Equals(ReplicaSynchronizationHealth 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationModeType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationModeType.cs new file mode 100644 index 000000000000..4d44c3a13cb4 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/ReplicationModeType.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.Sql.Models +{ + /// Replication mode of the link. + public readonly partial struct ReplicationModeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReplicationModeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AsyncValue = "Async"; + private const string SyncValue = "Sync"; + + /// Async. + public static ReplicationModeType Async { get; } = new ReplicationModeType(AsyncValue); + /// Sync. + public static ReplicationModeType Sync { get; } = new ReplicationModeType(SyncValue); + /// Determines if two values are the same. + public static bool operator ==(ReplicationModeType left, ReplicationModeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReplicationModeType left, ReplicationModeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ReplicationModeType(string value) => new ReplicationModeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReplicationModeType other && Equals(other); + /// + public bool Equals(ReplicationModeType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RoleChangeType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RoleChangeType.cs new file mode 100644 index 000000000000..50b4b744c2a2 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/RoleChangeType.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.Sql.Models +{ + /// The type of the role change, can be Planned or Forced. + public readonly partial struct RoleChangeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RoleChangeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ForcedValue = "Forced"; + private const string PlannedValue = "Planned"; + + /// Forced. + public static RoleChangeType Forced { get; } = new RoleChangeType(ForcedValue); + /// Planned. + public static RoleChangeType Planned { get; } = new RoleChangeType(PlannedValue); + /// Determines if two values are the same. + public static bool operator ==(RoleChangeType left, RoleChangeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RoleChangeType left, RoleChangeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator RoleChangeType(string value) => new RoleChangeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RoleChangeType other && Equals(other); + /// + public bool Equals(RoleChangeType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SeedingModeType.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SeedingModeType.cs new file mode 100644 index 000000000000..7652b7717826 --- /dev/null +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/Models/SeedingModeType.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.Sql.Models +{ + /// Database seeding mode – can be Automatic (default), or Manual for supported scenarios. + public readonly partial struct SeedingModeType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SeedingModeType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutomaticValue = "Automatic"; + private const string ManualValue = "Manual"; + + /// Automatic. + public static SeedingModeType Automatic { get; } = new SeedingModeType(AutomaticValue); + /// Manual. + public static SeedingModeType Manual { get; } = new SeedingModeType(ManualValue); + /// Determines if two values are the same. + public static bool operator ==(SeedingModeType left, SeedingModeType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SeedingModeType left, SeedingModeType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SeedingModeType(string value) => new SeedingModeType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SeedingModeType other && Equals(other); + /// + public bool Equals(SeedingModeType 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/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs index cc22d3b4faa4..f2082c8f303a 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/DistributedAvailabilityGroupsRestOperations.cs @@ -32,7 +32,7 @@ public DistributedAvailabilityGroupsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-11-01-preview"; + _apiVersion = apiVersion ?? "2023-08-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -369,6 +369,7 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG uri.AppendPath(distributedAvailabilityGroupName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } @@ -529,6 +530,210 @@ public Response Update(string subscriptionId, string resourceGroupName, string m } } + internal RequestUriBuilder CreateFailoverRequestUri(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupsFailoverContent 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendPath("/failover", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateFailoverRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupsFailoverContent 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendPath("/failover", 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; + } + + /// Performs requested failover type in this distributed availability group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group failover request parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task FailoverAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupsFailoverContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, 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); + } + } + + /// Performs requested failover type in this distributed availability group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group failover request parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Failover(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupsFailoverContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateFailoverRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateSetRoleRequestUri(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole) + { + 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendPath("/setRole", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateSetRoleRequest(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole) + { + 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/distributedAvailabilityGroups/", false); + uri.AppendPath(distributedAvailabilityGroupName, true); + uri.AppendPath("/setRole", 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(distributedAvailabilityGroupSetRole, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Sets the role for managed instance in a distributed availability group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group set role request parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task SetRoleAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(distributedAvailabilityGroupSetRole, nameof(distributedAvailabilityGroupSetRole)); + + using var message = CreateSetRoleRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, distributedAvailabilityGroupSetRole); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Sets the role for managed instance in a distributed availability group. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The distributed availability group name. + /// The distributed availability group set role request parameters. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response SetRole(string subscriptionId, string resourceGroupName, string managedInstanceName, string distributedAvailabilityGroupName, DistributedAvailabilityGroupSetRole distributedAvailabilityGroupSetRole, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + Argument.AssertNotNullOrEmpty(distributedAvailabilityGroupName, nameof(distributedAvailabilityGroupName)); + Argument.AssertNotNull(distributedAvailabilityGroupSetRole, nameof(distributedAvailabilityGroupSetRole)); + + using var message = CreateSetRoleRequest(subscriptionId, resourceGroupName, managedInstanceName, distributedAvailabilityGroupName, distributedAvailabilityGroupSetRole); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateListByInstanceNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string managedInstanceName) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs index 166a5ca36f62..5258655cf0b8 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/Generated/RestOperations/ManagedInstancesRestOperations.cs @@ -32,7 +32,7 @@ public ManagedInstancesRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-08-01-preview"; + _apiVersion = apiVersion ?? "2023-05-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -890,6 +890,92 @@ public Response ListOutboundNetworkDep } } + internal RequestUriBuilder CreateRefreshStatusRequestUri(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/refreshExternalGovernanceStatus", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateRefreshStatusRequest(string subscriptionId, string resourceGroupName, string managedInstanceName) + { + 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.Sql/managedInstances/", false); + uri.AppendPath(managedInstanceName, true); + uri.AppendPath("/refreshExternalGovernanceStatus", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Refresh external governance enablement status. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task RefreshStatusAsync(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateRefreshStatusRequest(subscriptionId, resourceGroupName, managedInstanceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Refresh external governance enablement status. + /// The subscription ID that identifies an Azure subscription. + /// The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. + /// The name of the managed instance. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response RefreshStatus(string subscriptionId, string resourceGroupName, string managedInstanceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(managedInstanceName, nameof(managedInstanceName)); + + using var message = CreateRefreshStatusRequest(subscriptionId, resourceGroupName, managedInstanceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateStartRequestUri(string subscriptionId, string resourceGroupName, string managedInstanceName) { var uri = new RawRequestUriBuilder(); @@ -921,6 +1007,7 @@ internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGr uri.AppendPath("/start", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } @@ -942,6 +1029,7 @@ public async Task StartAsync(string subscriptionId, string resourceGro await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 200: case 202: return message.Response; default: @@ -966,6 +1054,7 @@ public Response Start(string subscriptionId, string resourceGroupName, string ma _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 200: case 202: return message.Response; default: @@ -1004,6 +1093,7 @@ internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGro uri.AppendPath("/stop", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; + request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); return message; } @@ -1025,6 +1115,7 @@ public async Task StopAsync(string subscriptionId, string resourceGrou await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { + case 200: case 202: return message.Response; default: @@ -1049,6 +1140,7 @@ public Response Stop(string subscriptionId, string resourceGroupName, string man _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { + case 200: case 202: return message.Response; default: diff --git a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md index 6a47c694e969..d25e4a271b28 100644 --- a/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md +++ b/sdk/sqlmanagement/Azure.ResourceManager.Sql/src/autorest.md @@ -5,7 +5,7 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml azure-arm: true tag: package-composite-v5 -require: https://github.com/Azure/azure-rest-api-specs/blob/f45a76fc39f033947ed12faf4b6416e1e19724cd/specification/sql/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/sql/resource-manager/readme.md #package-composite-v5 namespace: Azure.ResourceManager.Sql output-folder: $(this-folder)/Generated diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..6d83bf7eebb6 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -9,9 +9,17 @@ trigger: paths: include: - sdk/storage/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/