From afddc6dba57861af30f14424b5c87aa96f6731db Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 19 Mar 2025 03:13:42 +0000 Subject: [PATCH] CodeGen from PR 33214 in Azure/azure-rest-api-specs Merge 0a80a10184111596f0eb8bf071a82eb7a69224b2 into 20a53fbfac5e280d8488b229ebf8e9fb70f63775 --- .../Azure.ResourceManager.DatabaseWatcher.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 ++ ....ResourceManager.DatabaseWatcher.net8.0.cs | 691 ++++++++++ ...eManager.DatabaseWatcher.netstandard2.0.cs | 691 ++++++++++ .../assets.json | 7 + ...urceManager.DatabaseWatcher.Samples.csproj | 13 + ...mple_DatabaseWatcherAlertRuleCollection.cs | 200 +++ ...Sample_DatabaseWatcherAlertRuleResource.cs | 113 ++ .../Sample_DatabaseWatcherCollection.cs | 206 +++ ...tabaseWatcherHealthValidationCollection.cs | 160 +++ ...DatabaseWatcherHealthValidationResource.cs | 81 ++ .../Samples/Sample_DatabaseWatcherResource.cs | 172 +++ ...atabaseWatcherSharedPrivateLinkResource.cs | 116 ++ ...cherSharedPrivateLinkResourceCollection.cs | 203 +++ .../Sample_DatabaseWatcherTargetCollection.cs | 200 +++ .../Sample_DatabaseWatcherTargetResource.cs | 113 ++ .../Sample_SubscriptionResourceExtensions.cs | 50 + ...ure.ResourceManager.DatabaseWatcher.csproj | 8 + .../ArmDatabaseWatcherModelFactory.cs | 312 +++++ .../DatabaseWatcherAlertRuleCollection.cs | 497 +++++++ ...abaseWatcherAlertRuleData.Serialization.cs | 155 +++ .../Generated/DatabaseWatcherAlertRuleData.cs | 75 ++ ...eWatcherAlertRuleResource.Serialization.cs | 26 + .../DatabaseWatcherAlertRuleResource.cs | 355 +++++ .../Generated/DatabaseWatcherCollection.cs | 494 +++++++ .../DatabaseWatcherData.Serialization.cs | 194 +++ .../src/Generated/DatabaseWatcherData.cs | 87 ++ ...tabaseWatcherHealthValidationCollection.cs | 395 ++++++ ...tcherHealthValidationData.Serialization.cs | 155 +++ .../DatabaseWatcherHealthValidationData.cs | 75 ++ ...rHealthValidationResource.Serialization.cs | 26 + ...DatabaseWatcherHealthValidationResource.cs | 255 ++++ .../DatabaseWatcherResource.Serialization.cs | 26 + .../src/Generated/DatabaseWatcherResource.cs | 1151 +++++++++++++++++ ...SharedPrivateLinkResource.Serialization.cs | 26 + ...atabaseWatcherSharedPrivateLinkResource.cs | 347 +++++ ...cherSharedPrivateLinkResourceCollection.cs | 493 +++++++ ...edPrivateLinkResourceData.Serialization.cs | 155 +++ ...aseWatcherSharedPrivateLinkResourceData.cs | 75 ++ .../DatabaseWatcherTargetCollection.cs | 497 +++++++ ...DatabaseWatcherTargetData.Serialization.cs | 155 +++ .../Generated/DatabaseWatcherTargetData.cs | 83 ++ ...baseWatcherTargetResource.Serialization.cs | 26 + .../DatabaseWatcherTargetResource.cs | 355 +++++ .../Extensions/DatabaseWatcherExtensions.cs | 295 +++++ .../MockableDatabaseWatcherArmClient.cs | 97 ++ ...bleDatabaseWatcherResourceGroupResource.cs | 105 ++ ...ableDatabaseWatcherSubscriptionResource.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 + .../DatabaseWatcherArmOperation.cs | 94 ++ .../DatabaseWatcherArmOperationOfT.cs | 100 ++ ...eWatcherHealthValidationOperationSource.cs | 36 + .../DatabaseWatcherOperationSource.cs | 36 + ...haredPrivateLinkResourceOperationSource.cs | 36 + .../Models/AlertRuleCreationProperty.cs | 51 + ...ertRuleResourceListResult.Serialization.cs | 151 +++ .../Models/AlertRuleResourceListResult.cs | 80 ++ ...atcherAlertRuleProperties.Serialization.cs | 180 +++ .../DatabaseWatcherAlertRuleProperties.cs | 106 ++ .../DatabaseWatcherDatastore.Serialization.cs | 192 +++ .../Models/DatabaseWatcherDatastore.cs | 111 ++ ...cherHealthValidationIssue.Serialization.cs | 215 +++ .../DatabaseWatcherHealthValidationIssue.cs | 101 ++ ...ealthValidationProperties.Serialization.cs | 193 +++ ...tabaseWatcherHealthValidationProperties.cs | 95 ++ .../DatabaseWatcherHealthValidationStatus.cs | 63 + .../DatabaseWatcherPatch.Serialization.cs | 174 +++ .../Generated/Models/DatabaseWatcherPatch.cs | 74 ++ ...DatabaseWatcherProperties.Serialization.cs | 178 +++ .../Models/DatabaseWatcherProperties.cs | 78 ++ .../DatabaseWatcherProvisioningState.cs | 54 + ...atabaseWatcherResourceProvisioningState.cs | 54 + ...ateLinkResourceProperties.Serialization.cs | 190 +++ ...cherSharedPrivateLinkResourceProperties.cs | 102 ++ ...eWatcherSharedPrivateLinkResourceStatus.cs | 57 + .../Generated/Models/DatabaseWatcherStatus.cs | 60 + ...seWatcherTargetProperties.Serialization.cs | 133 ++ .../Models/DatabaseWatcherTargetProperties.cs | 97 ++ ...ealthValidationListResult.Serialization.cs | 151 +++ .../Models/HealthValidationListResult.cs | 80 ++ .../src/Generated/Models/KustoOfferingType.cs | 54 + .../Models/ManagedServiceIdentityType.cs | 57 + .../ManagedServiceIdentityV4.Serialization.cs | 183 +++ .../Models/ManagedServiceIdentityV4.cs | 86 ++ ...ateLinkResourceListResult.Serialization.cs | 151 +++ .../SharedPrivateLinkResourceListResult.cs | 80 ++ ...asticPoolTargetProperties.Serialization.cs | 182 +++ .../SqlDBElasticPoolTargetProperties.cs | 64 + ...eDatabaseTargetProperties.Serialization.cs | 173 +++ .../SqlDBSingleDatabaseTargetProperties.cs | 57 + .../SqlMITargetProperties.Serialization.cs | 189 +++ .../Generated/Models/SqlMITargetProperties.cs | 61 + .../Models/TargetAuthenticationType.cs | 51 + ...AuthenticationVaultSecret.Serialization.cs | 155 +++ .../Models/TargetAuthenticationVaultSecret.cs | 74 ++ .../Models/TargetListResult.Serialization.cs | 151 +++ .../src/Generated/Models/TargetListResult.cs | 80 ++ ...seWatcherTargetProperties.Serialization.cs | 148 +++ .../UnknownDatabaseWatcherTargetProperties.cs | 33 + .../Models/WatcherListResult.Serialization.cs | 151 +++ .../src/Generated/Models/WatcherListResult.cs | 80 ++ .../WatcherUpdateProperties.Serialization.cs | 148 +++ .../Models/WatcherUpdateProperties.cs | 70 + .../src/Generated/ProviderConstants.cs | 16 + .../AlertRuleResourcesRestOperations.cs | 523 ++++++++ .../HealthValidationsRestOperations.cs | 415 ++++++ ...haredPrivateLinkResourcesRestOperations.cs | 513 ++++++++ .../RestOperations/TargetsRestOperations.cs | 523 ++++++++ .../RestOperations/WatchersRestOperations.cs | 895 +++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...sourceManager.DatabaseWatcher.Tests.csproj | 8 + .../DatabaseWatcherManagementTestBase.cs | 45 + ...atabaseWatcherManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/databasewatcher/ci.mgmt.yml | 26 + sdk/resourcemanager/ci.mgmt.yml | 6 +- sdk/storage/ci.yml | 2 + 124 files changed, 20016 insertions(+), 2 deletions(-) create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Azure.ResourceManager.DatabaseWatcher.sln create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/CHANGELOG.md create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Directory.Build.props create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/README.md create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.net8.0.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.netstandard2.0.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/assets.json create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Azure.ResourceManager.DatabaseWatcher.Samples.csproj create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Azure.ResourceManager.DatabaseWatcher.csproj create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ArmDatabaseWatcherModelFactory.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/DatabaseWatcherExtensions.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherArmClient.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherResourceGroupResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherSubscriptionResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Argument.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Optional.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperation.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperationOfT.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherHealthValidationOperationSource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherOperationSource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherSharedPrivateLinkResourceOperationSource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleCreationProperty.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationStatus.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProvisioningState.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherResourceProvisioningState.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceStatus.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherStatus.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/KustoOfferingType.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityType.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationType.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ProviderConstants.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/AlertRuleResourcesRestOperations.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/HealthValidationsRestOperations.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/TargetsRestOperations.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/WatchersRestOperations.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Properties/AssemblyInfo.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/Azure.ResourceManager.DatabaseWatcher.Tests.csproj create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestBase.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestEnvironment.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tsp-location.yaml create mode 100644 sdk/databasewatcher/ci.mgmt.yml diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Azure.ResourceManager.DatabaseWatcher.sln b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Azure.ResourceManager.DatabaseWatcher.sln new file mode 100644 index 000000000000..313caa46f33f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Azure.ResourceManager.DatabaseWatcher.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.DatabaseWatcher.Samples", "samples\Azure.ResourceManager.DatabaseWatcher.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DatabaseWatcher", "src\Azure.ResourceManager.DatabaseWatcher.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.DatabaseWatcher.Tests", "tests\Azure.ResourceManager.DatabaseWatcher.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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/CHANGELOG.md b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Directory.Build.props b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/README.md b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/README.md new file mode 100644 index 000000000000..876bc6678452 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure DatabaseWatcher 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 DatabaseWatcher management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.DatabaseWatcher --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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.net8.0.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.net8.0.cs new file mode 100644 index 000000000000..46a0b0285b4d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.net8.0.cs @@ -0,0 +1,691 @@ +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherAlertRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherAlertRuleCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string alertRuleResourceName, 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 alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string alertRuleResourceName, 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 DatabaseWatcherAlertRuleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherAlertRuleData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.DatabaseWatcher.DatabaseWatcherAlertRuleData 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 DatabaseWatcherAlertRuleResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherAlertRuleResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string watcherName, 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 watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string watcherName, 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 DatabaseWatcherData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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.DatabaseWatcher.DatabaseWatcherData 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 DatabaseWatcherExtensions + { + public static Azure.Response GetDatabaseWatcher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static System.Threading.Tasks.Task> GetDatabaseWatcherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherResource GetDatabaseWatcherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherCollection GetDatabaseWatchers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDatabaseWatchers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDatabaseWatchersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DatabaseWatcherHealthValidationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherHealthValidationCollection() { } + public virtual Azure.Response Exists(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string healthValidationName, 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 healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string healthValidationName, 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 DatabaseWatcherHealthValidationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData 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.DatabaseWatcher.DatabaseWatcherHealthValidationData 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 DatabaseWatcherHealthValidationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherHealthValidationResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) { 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 StartValidation(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StartValidationAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData 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.DatabaseWatcher.DatabaseWatcherHealthValidationData 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 DatabaseWatcherResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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 watcherName) { 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 GetDatabaseWatcherAlertRule(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherAlertRuleAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleCollection GetDatabaseWatcherAlertRules() { throw null; } + public virtual Azure.Response GetDatabaseWatcherHealthValidation(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherHealthValidationAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationCollection GetDatabaseWatcherHealthValidations() { throw null; } + public virtual Azure.Response GetDatabaseWatcherSharedPrivateLinkResource(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceCollection GetDatabaseWatcherSharedPrivateLinkResources() { throw null; } + public virtual Azure.Response GetDatabaseWatcherTarget(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherTargetAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetCollection GetDatabaseWatcherTargets() { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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.DatabaseWatcher.DatabaseWatcherData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherSharedPrivateLinkResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherSharedPrivateLinkResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string sharedPrivateLinkResourceName, 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 sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string sharedPrivateLinkResourceName, 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 DatabaseWatcherSharedPrivateLinkResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherSharedPrivateLinkResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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 DatabaseWatcherTargetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherTargetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string targetName, 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 targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string targetName, 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 DatabaseWatcherTargetData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherTargetData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData 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.DatabaseWatcher.DatabaseWatcherTargetData 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 DatabaseWatcherTargetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherTargetResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string targetName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData 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.DatabaseWatcher.DatabaseWatcherTargetData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DatabaseWatcher.Mocking +{ + public partial class MockableDatabaseWatcherArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherArmClient() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherResource GetDatabaseWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDatabaseWatcherResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherResourceGroupResource() { } + public virtual Azure.Response GetDatabaseWatcher(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherCollection GetDatabaseWatchers() { throw null; } + } + public partial class MockableDatabaseWatcherSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherSubscriptionResource() { } + public virtual Azure.Pageable GetDatabaseWatchers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDatabaseWatchersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AlertRuleCreationProperty : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AlertRuleCreationProperty(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty CreatedWithActionGroup { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty 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.DatabaseWatcher.Models.AlertRuleCreationProperty left, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty left, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmDatabaseWatcherModelFactory + { + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData DatabaseWatcherAlertRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties DatabaseWatcherAlertRuleProperties(Azure.Core.ResourceIdentifier alertRuleResourceId = null, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty createdWithProperties = default(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty), System.DateTimeOffset createdOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData DatabaseWatcherData(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.DatabaseWatcher.Models.DatabaseWatcherProperties properties = null, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 identity = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData DatabaseWatcherHealthValidationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue DatabaseWatcherHealthValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, System.Uri recommendationUri = null, Azure.Core.ResourceIdentifier relatedResourceId = null, Azure.Core.ResourceType? relatedResourceType = default(Azure.Core.ResourceType?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties DatabaseWatcherHealthValidationProperties(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus), System.Collections.Generic.IEnumerable issues = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties DatabaseWatcherProperties(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore datastore = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState?), Azure.Core.ResourceIdentifier defaultAlertRuleIdentityResourceId = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData DatabaseWatcherSharedPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties DatabaseWatcherSharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData DatabaseWatcherTargetData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties DatabaseWatcherTargetProperties(string targetType = null, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 ManagedServiceIdentityV4(System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType type = default(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType), System.Collections.Generic.IDictionary userAssignedIdentities = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties SqlDBElasticPoolTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlEpResourceId = null, Azure.Core.ResourceIdentifier anchorDatabaseResourceId = null, bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties SqlDBSingleDatabaseTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlDbResourceId = null, bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlMITargetProperties SqlMITargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlMiResourceId = null, int? connectionTcpPort = default(int?), bool? readIntent = default(bool?)) { throw null; } + } + public partial class DatabaseWatcherAlertRuleProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherAlertRuleProperties(Azure.Core.ResourceIdentifier alertRuleResourceId, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty createdWithProperties, System.DateTimeOffset createdOn, string alertRuleTemplateId, string alertRuleTemplateVersion) { } + public Azure.Core.ResourceIdentifier AlertRuleResourceId { get { throw null; } set { } } + public string AlertRuleTemplateId { get { throw null; } set { } } + public string AlertRuleTemplateVersion { get { throw null; } set { } } + public System.DateTimeOffset CreatedOn { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty CreatedWithProperties { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties 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.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties 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 DatabaseWatcherDatastore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherDatastore(System.Uri kustoClusterUri, System.Uri kustoDataIngestionUri, string kustoDatabaseName, System.Uri kustoManagementUri, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType kustoOfferingType) { } + public Azure.Core.ResourceIdentifier AdxClusterResourceId { get { throw null; } set { } } + public string KustoClusterDisplayName { get { throw null; } set { } } + public System.Uri KustoClusterUri { get { throw null; } set { } } + public string KustoDatabaseName { get { throw null; } set { } } + public System.Uri KustoDataIngestionUri { get { throw null; } set { } } + public System.Uri KustoManagementUri { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType KustoOfferingType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore 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.DatabaseWatcher.Models.DatabaseWatcherDatastore 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 DatabaseWatcherHealthValidationIssue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationIssue() { } + public string AdditionalDetails { get { throw null; } } + public string ErrorCode { get { throw null; } } + public string ErrorMessage { get { throw null; } } + public string RecommendationMessage { get { throw null; } } + public System.Uri RecommendationUri { get { throw null; } } + public Azure.Core.ResourceIdentifier RelatedResourceId { get { throw null; } } + public Azure.Core.ResourceType? RelatedResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue 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 DatabaseWatcherHealthValidationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationProperties() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Issues { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties 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 DatabaseWatcherHealthValidationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherHealthValidationStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus NotStarted { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus TimedOut { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseWatcherPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherPatch() { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.WatcherUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch 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.DatabaseWatcher.Models.DatabaseWatcherPatch 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 DatabaseWatcherProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore Datastore { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier DefaultAlertRuleIdentityResourceId { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties 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.DatabaseWatcher.Models.DatabaseWatcherProperties 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 DatabaseWatcherProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState 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.DatabaseWatcher.Models.DatabaseWatcherProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DatabaseWatcherResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState 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.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherSharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId, string groupId, string requestMessage) { } + public string DnsZone { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier PrivateLinkResourceId { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public string RequestMessage { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties 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.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties 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 DatabaseWatcherSharedPrivateLinkResourceStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherSharedPrivateLinkResourceStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Approved { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Disconnected { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Pending { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus 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.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DatabaseWatcherStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Deleting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Starting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Stopped { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Stopping { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus 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.DatabaseWatcher.Models.DatabaseWatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class DatabaseWatcherTargetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DatabaseWatcherTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName) { } + public string ConnectionServerName { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType TargetAuthenticationType { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret TargetVault { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties 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.DatabaseWatcher.Models.DatabaseWatcherTargetProperties 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 KustoOfferingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KustoOfferingType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Adx { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Fabric { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Free { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType 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.DatabaseWatcher.Models.KustoOfferingType left, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType left, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ManagedServiceIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ManagedServiceIdentityType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType None { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType SystemAndUserAssigned { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType SystemAssigned { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType UserAssigned { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType 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.DatabaseWatcher.Models.ManagedServiceIdentityType left, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType left, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagedServiceIdentityV4 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ManagedServiceIdentityV4(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType type) { } + public System.Guid? PrincipalId { get { throw null; } } + public System.Guid? TenantId { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType Type { get { throw null; } set { } } + public System.Collections.Generic.IDictionary UserAssignedIdentities { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 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.DatabaseWatcher.Models.ManagedServiceIdentityV4 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 SqlDBElasticPoolTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlDBElasticPoolTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlEpResourceId, Azure.Core.ResourceIdentifier anchorDatabaseResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public Azure.Core.ResourceIdentifier AnchorDatabaseResourceId { get { throw null; } set { } } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlEpResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties 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.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties 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 SqlDBSingleDatabaseTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlDBSingleDatabaseTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlDbResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlDbResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties 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.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties 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 SqlMITargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlMITargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlMiResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public int? ConnectionTcpPort { get { throw null; } set { } } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlMiResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlMITargetProperties 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.DatabaseWatcher.Models.SqlMITargetProperties 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 TargetAuthenticationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TargetAuthenticationType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType Aad { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType Sql { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType 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.DatabaseWatcher.Models.TargetAuthenticationType left, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType left, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TargetAuthenticationVaultSecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TargetAuthenticationVaultSecret() { } + public Azure.Core.ResourceIdentifier AkvResourceId { get { throw null; } set { } } + public string AkvTargetPassword { get { throw null; } set { } } + public string AkvTargetUser { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret 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.DatabaseWatcher.Models.TargetAuthenticationVaultSecret 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 WatcherUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherUpdateProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore Datastore { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier DefaultAlertRuleIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.WatcherUpdateProperties 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.DatabaseWatcher.Models.WatcherUpdateProperties 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.netstandard2.0.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.netstandard2.0.cs new file mode 100644 index 000000000000..46a0b0285b4d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/api/Azure.ResourceManager.DatabaseWatcher.netstandard2.0.cs @@ -0,0 +1,691 @@ +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherAlertRuleCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherAlertRuleCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string alertRuleResourceName, 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 alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string alertRuleResourceName, 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 DatabaseWatcherAlertRuleData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherAlertRuleData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.DatabaseWatcher.DatabaseWatcherAlertRuleData 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 DatabaseWatcherAlertRuleResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherAlertRuleResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.DatabaseWatcher.DatabaseWatcherAlertRuleData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string watcherName, 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 watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string watcherName, 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 DatabaseWatcherData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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.DatabaseWatcher.DatabaseWatcherData 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 DatabaseWatcherExtensions + { + public static Azure.Response GetDatabaseWatcher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static System.Threading.Tasks.Task> GetDatabaseWatcherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherResource GetDatabaseWatcherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherCollection GetDatabaseWatchers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetDatabaseWatchers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetDatabaseWatchersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DatabaseWatcherHealthValidationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherHealthValidationCollection() { } + public virtual Azure.Response Exists(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string healthValidationName, 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 healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string healthValidationName, 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 DatabaseWatcherHealthValidationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData 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.DatabaseWatcher.DatabaseWatcherHealthValidationData 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 DatabaseWatcherHealthValidationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherHealthValidationResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) { 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 StartValidation(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> StartValidationAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData 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.DatabaseWatcher.DatabaseWatcherHealthValidationData 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 DatabaseWatcherResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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 watcherName) { 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 GetDatabaseWatcherAlertRule(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherAlertRuleAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleCollection GetDatabaseWatcherAlertRules() { throw null; } + public virtual Azure.Response GetDatabaseWatcherHealthValidation(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherHealthValidationAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationCollection GetDatabaseWatcherHealthValidations() { throw null; } + public virtual Azure.Response GetDatabaseWatcherSharedPrivateLinkResource(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceCollection GetDatabaseWatcherSharedPrivateLinkResources() { throw null; } + public virtual Azure.Response GetDatabaseWatcherTarget(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherTargetAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetCollection GetDatabaseWatcherTargets() { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData 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.DatabaseWatcher.DatabaseWatcherData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherSharedPrivateLinkResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherSharedPrivateLinkResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string sharedPrivateLinkResourceName, 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 sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string sharedPrivateLinkResourceName, 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 DatabaseWatcherSharedPrivateLinkResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherSharedPrivateLinkResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData 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 DatabaseWatcherTargetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DatabaseWatcherTargetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string targetName, 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 targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string targetName, 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 DatabaseWatcherTargetData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherTargetData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData 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.DatabaseWatcher.DatabaseWatcherTargetData 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 DatabaseWatcherTargetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DatabaseWatcherTargetResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string targetName) { 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; } + Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData 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.DatabaseWatcher.DatabaseWatcherTargetData 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.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DatabaseWatcher.Mocking +{ + public partial class MockableDatabaseWatcherArmClient : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherArmClient() { } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherResource GetDatabaseWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDatabaseWatcherResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherResourceGroupResource() { } + public virtual Azure.Response GetDatabaseWatcher(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDatabaseWatcherAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherCollection GetDatabaseWatchers() { throw null; } + } + public partial class MockableDatabaseWatcherSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherSubscriptionResource() { } + public virtual Azure.Pageable GetDatabaseWatchers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDatabaseWatchersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AlertRuleCreationProperty : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AlertRuleCreationProperty(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty CreatedWithActionGroup { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty None { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty 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.DatabaseWatcher.Models.AlertRuleCreationProperty left, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty left, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmDatabaseWatcherModelFactory + { + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherAlertRuleData DatabaseWatcherAlertRuleData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties DatabaseWatcherAlertRuleProperties(Azure.Core.ResourceIdentifier alertRuleResourceId = null, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty createdWithProperties = default(Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty), System.DateTimeOffset createdOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherData DatabaseWatcherData(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.DatabaseWatcher.Models.DatabaseWatcherProperties properties = null, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 identity = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherHealthValidationData DatabaseWatcherHealthValidationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue DatabaseWatcherHealthValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, System.Uri recommendationUri = null, Azure.Core.ResourceIdentifier relatedResourceId = null, Azure.Core.ResourceType? relatedResourceType = default(Azure.Core.ResourceType?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties DatabaseWatcherHealthValidationProperties(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus), System.Collections.Generic.IEnumerable issues = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties DatabaseWatcherProperties(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore datastore = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState?), Azure.Core.ResourceIdentifier defaultAlertRuleIdentityResourceId = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherSharedPrivateLinkResourceData DatabaseWatcherSharedPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties DatabaseWatcherSharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.DatabaseWatcherTargetData DatabaseWatcherTargetData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties DatabaseWatcherTargetProperties(string targetType = null, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 ManagedServiceIdentityV4(System.Guid? principalId = default(System.Guid?), System.Guid? tenantId = default(System.Guid?), Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType type = default(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType), System.Collections.Generic.IDictionary userAssignedIdentities = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties SqlDBElasticPoolTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlEpResourceId = null, Azure.Core.ResourceIdentifier anchorDatabaseResourceId = null, bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties SqlDBSingleDatabaseTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlDbResourceId = null, bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SqlMITargetProperties SqlMITargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlMiResourceId = null, int? connectionTcpPort = default(int?), bool? readIntent = default(bool?)) { throw null; } + } + public partial class DatabaseWatcherAlertRuleProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherAlertRuleProperties(Azure.Core.ResourceIdentifier alertRuleResourceId, Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty createdWithProperties, System.DateTimeOffset createdOn, string alertRuleTemplateId, string alertRuleTemplateVersion) { } + public Azure.Core.ResourceIdentifier AlertRuleResourceId { get { throw null; } set { } } + public string AlertRuleTemplateId { get { throw null; } set { } } + public string AlertRuleTemplateVersion { get { throw null; } set { } } + public System.DateTimeOffset CreatedOn { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleCreationProperty CreatedWithProperties { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties 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.DatabaseWatcher.Models.DatabaseWatcherAlertRuleProperties 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 DatabaseWatcherDatastore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherDatastore(System.Uri kustoClusterUri, System.Uri kustoDataIngestionUri, string kustoDatabaseName, System.Uri kustoManagementUri, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType kustoOfferingType) { } + public Azure.Core.ResourceIdentifier AdxClusterResourceId { get { throw null; } set { } } + public string KustoClusterDisplayName { get { throw null; } set { } } + public System.Uri KustoClusterUri { get { throw null; } set { } } + public string KustoDatabaseName { get { throw null; } set { } } + public System.Uri KustoDataIngestionUri { get { throw null; } set { } } + public System.Uri KustoManagementUri { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType KustoOfferingType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore 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.DatabaseWatcher.Models.DatabaseWatcherDatastore 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 DatabaseWatcherHealthValidationIssue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationIssue() { } + public string AdditionalDetails { get { throw null; } } + public string ErrorCode { get { throw null; } } + public string ErrorMessage { get { throw null; } } + public string RecommendationMessage { get { throw null; } } + public System.Uri RecommendationUri { get { throw null; } } + public Azure.Core.ResourceIdentifier RelatedResourceId { get { throw null; } } + public Azure.Core.ResourceType? RelatedResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationIssue 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 DatabaseWatcherHealthValidationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DatabaseWatcherHealthValidationProperties() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Issues { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationProperties 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 DatabaseWatcherHealthValidationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherHealthValidationStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus NotStarted { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus TimedOut { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus 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.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherHealthValidationStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseWatcherPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherPatch() { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.WatcherUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherPatch 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.DatabaseWatcher.Models.DatabaseWatcherPatch 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 DatabaseWatcherProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore Datastore { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier DefaultAlertRuleIdentityResourceId { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProperties 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.DatabaseWatcher.Models.DatabaseWatcherProperties 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 DatabaseWatcherProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState 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.DatabaseWatcher.Models.DatabaseWatcherProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DatabaseWatcherResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState 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.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DatabaseWatcherSharedPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DatabaseWatcherSharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId, string groupId, string requestMessage) { } + public string DnsZone { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier PrivateLinkResourceId { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public string RequestMessage { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties 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.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceProperties 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 DatabaseWatcherSharedPrivateLinkResourceStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherSharedPrivateLinkResourceStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Approved { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Disconnected { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Pending { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus 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.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherSharedPrivateLinkResourceStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DatabaseWatcherStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DatabaseWatcherStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Deleting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Starting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Stopped { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus Stopping { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus 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.DatabaseWatcher.Models.DatabaseWatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherStatus right) { throw null; } + public override string ToString() { throw null; } + } + public abstract partial class DatabaseWatcherTargetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected DatabaseWatcherTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName) { } + public string ConnectionServerName { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType TargetAuthenticationType { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret TargetVault { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties 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.DatabaseWatcher.Models.DatabaseWatcherTargetProperties 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 KustoOfferingType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KustoOfferingType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Adx { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Fabric { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType Free { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType 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.DatabaseWatcher.Models.KustoOfferingType left, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType left, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ManagedServiceIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ManagedServiceIdentityType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType None { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType SystemAndUserAssigned { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType SystemAssigned { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType UserAssigned { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType 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.DatabaseWatcher.Models.ManagedServiceIdentityType left, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType left, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagedServiceIdentityV4 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ManagedServiceIdentityV4(Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType type) { } + public System.Guid? PrincipalId { get { throw null; } } + public System.Guid? TenantId { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityType Type { get { throw null; } set { } } + public System.Collections.Generic.IDictionary UserAssignedIdentities { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 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.DatabaseWatcher.Models.ManagedServiceIdentityV4 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 SqlDBElasticPoolTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlDBElasticPoolTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlEpResourceId, Azure.Core.ResourceIdentifier anchorDatabaseResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public Azure.Core.ResourceIdentifier AnchorDatabaseResourceId { get { throw null; } set { } } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlEpResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties 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.DatabaseWatcher.Models.SqlDBElasticPoolTargetProperties 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 SqlDBSingleDatabaseTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlDBSingleDatabaseTargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlDbResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlDbResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties 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.DatabaseWatcher.Models.SqlDBSingleDatabaseTargetProperties 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 SqlMITargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherTargetProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SqlMITargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName, Azure.Core.ResourceIdentifier sqlMiResourceId) : base (default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), default(string)) { } + public int? ConnectionTcpPort { get { throw null; } set { } } + public bool? ReadIntent { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier SqlMiResourceId { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SqlMITargetProperties 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.DatabaseWatcher.Models.SqlMITargetProperties 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 TargetAuthenticationType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public TargetAuthenticationType(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType Aad { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType Sql { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType 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.DatabaseWatcher.Models.TargetAuthenticationType left, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType left, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class TargetAuthenticationVaultSecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TargetAuthenticationVaultSecret() { } + public Azure.Core.ResourceIdentifier AkvResourceId { get { throw null; } set { } } + public string AkvTargetPassword { get { throw null; } set { } } + public string AkvTargetUser { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationVaultSecret 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.DatabaseWatcher.Models.TargetAuthenticationVaultSecret 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 WatcherUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherUpdateProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherDatastore Datastore { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier DefaultAlertRuleIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.WatcherUpdateProperties 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.DatabaseWatcher.Models.WatcherUpdateProperties 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/assets.json b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/assets.json new file mode 100644 index 000000000000..169779905282 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/databasewatcher/Azure.ResourceManager.DatabaseWatcher", + "Tag": "" +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Azure.ResourceManager.DatabaseWatcher.Samples.csproj b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Azure.ResourceManager.DatabaseWatcher.Samples.csproj new file mode 100644 index 000000000000..4750448f1e63 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Azure.ResourceManager.DatabaseWatcher.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleCollection.cs new file mode 100644 index 000000000000..24f35fece0c0 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherAlertRuleCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AlertRuleResourcesCreateOrUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherAlertRuleResource + DatabaseWatcherAlertRuleCollection collection = databaseWatcher.GetDatabaseWatcherAlertRules(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + DatabaseWatcherAlertRuleData data = new DatabaseWatcherAlertRuleData + { + Properties = new DatabaseWatcherAlertRuleProperties(new ResourceIdentifier("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), AlertRuleCreationProperty.CreatedWithActionGroup, DateTimeOffset.Parse("2024-07-25T15:38:47.798Z"), "someTemplateId", "1.0"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, alertRuleResourceName, data); + DatabaseWatcherAlertRuleResource 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 + DatabaseWatcherAlertRuleData 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_AlertRuleResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherAlertRuleResource + DatabaseWatcherAlertRuleCollection collection = databaseWatcher.GetDatabaseWatcherAlertRules(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + DatabaseWatcherAlertRuleResource result = await collection.GetAsync(alertRuleResourceName); + + // 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 + DatabaseWatcherAlertRuleData 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_AlertRuleResourcesListByParentMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_ListByParent_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_ListByParent" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherAlertRuleResource + DatabaseWatcherAlertRuleCollection collection = databaseWatcher.GetDatabaseWatcherAlertRules(); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherAlertRuleResource 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 + DatabaseWatcherAlertRuleData 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_AlertRuleResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherAlertRuleResource + DatabaseWatcherAlertRuleCollection collection = databaseWatcher.GetDatabaseWatcherAlertRules(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + bool result = await collection.ExistsAsync(alertRuleResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AlertRuleResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherAlertRuleResource + DatabaseWatcherAlertRuleCollection collection = databaseWatcher.GetDatabaseWatcherAlertRules(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + NullableResponse response = await collection.GetIfExistsAsync(alertRuleResourceName); + DatabaseWatcherAlertRuleResource 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 + DatabaseWatcherAlertRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleResource.cs new file mode 100644 index 000000000000..137df633215c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherAlertRuleResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherAlertRuleResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AlertRuleResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherAlertRuleResource created on azure + // for more information of creating DatabaseWatcherAlertRuleResource, please refer to the document of DatabaseWatcherAlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier databaseWatcherAlertRuleResourceId = DatabaseWatcherAlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + DatabaseWatcherAlertRuleResource databaseWatcherAlertRule = client.GetDatabaseWatcherAlertRuleResource(databaseWatcherAlertRuleResourceId); + + // invoke the operation + DatabaseWatcherAlertRuleResource result = await databaseWatcherAlertRule.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 + DatabaseWatcherAlertRuleData 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_AlertRuleResourcesDeleteMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherAlertRuleResource created on azure + // for more information of creating DatabaseWatcherAlertRuleResource, please refer to the document of DatabaseWatcherAlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier databaseWatcherAlertRuleResourceId = DatabaseWatcherAlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + DatabaseWatcherAlertRuleResource databaseWatcherAlertRule = client.GetDatabaseWatcherAlertRuleResource(databaseWatcherAlertRuleResourceId); + + // invoke the operation + await databaseWatcherAlertRule.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AlertRuleResourcesCreateOrUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/AlertRuleResources_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AlertRuleResource_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 DatabaseWatcherAlertRuleResource created on azure + // for more information of creating DatabaseWatcherAlertRuleResource, please refer to the document of DatabaseWatcherAlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier databaseWatcherAlertRuleResourceId = DatabaseWatcherAlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + DatabaseWatcherAlertRuleResource databaseWatcherAlertRule = client.GetDatabaseWatcherAlertRuleResource(databaseWatcherAlertRuleResourceId); + + // invoke the operation + DatabaseWatcherAlertRuleData data = new DatabaseWatcherAlertRuleData + { + Properties = new DatabaseWatcherAlertRuleProperties(new ResourceIdentifier("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878Be/resourceGroups/rgWatcher/providers/microsoft.insights/scheduledqueryrules/alerts-demo"), AlertRuleCreationProperty.CreatedWithActionGroup, DateTimeOffset.Parse("2024-07-25T15:38:47.798Z"), "someTemplateId", "1.0"), + }; + ArmOperation lro = await databaseWatcherAlertRule.UpdateAsync(WaitUntil.Completed, data); + DatabaseWatcherAlertRuleResource 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 + DatabaseWatcherAlertRuleData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherCollection.cs new file mode 100644 index 000000000000..51a94f93c737 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherCollection.cs @@ -0,0 +1,206 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_WatchersCreateOrUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseWatcherResource + DatabaseWatcherCollection collection = resourceGroupResource.GetDatabaseWatchers(); + + // invoke the operation + string watcherName = "testWatcher"; + DatabaseWatcherData data = new DatabaseWatcherData(new AzureLocation("eastus2")) + { + Properties = new DatabaseWatcherProperties + { + Datastore = new DatabaseWatcherDatastore(new Uri("https://kustouri-adx.eastus.kusto.windows.net"), new Uri("https://ingest-kustouri-adx.eastus.kusto.windows.net"), "kustoDatabaseName1", new Uri("https://portal.azure.com/"), KustoOfferingType.Adx) + { + AdxClusterResourceId = new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + KustoClusterDisplayName = "kustoUri-adx", + }, + DefaultAlertRuleIdentityResourceId = new ResourceIdentifier("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/3pmtest"), + }, + Identity = new ManagedServiceIdentityV4(ManagedServiceIdentityType.SystemAssigned), + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, watcherName, data); + DatabaseWatcherResource 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 + DatabaseWatcherData 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_WatchersGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseWatcherResource + DatabaseWatcherCollection collection = resourceGroupResource.GetDatabaseWatchers(); + + // invoke the operation + string watcherName = "myWatcher"; + DatabaseWatcherResource result = await collection.GetAsync(watcherName); + + // 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 + DatabaseWatcherData 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_WatchersListByResourceGroupMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseWatcherResource + DatabaseWatcherCollection collection = resourceGroupResource.GetDatabaseWatchers(); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherResource 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 + DatabaseWatcherData 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_WatchersGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseWatcherResource + DatabaseWatcherCollection collection = resourceGroupResource.GetDatabaseWatchers(); + + // invoke the operation + string watcherName = "myWatcher"; + bool result = await collection.ExistsAsync(watcherName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_WatchersGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this DatabaseWatcherResource + DatabaseWatcherCollection collection = resourceGroupResource.GetDatabaseWatchers(); + + // invoke the operation + string watcherName = "myWatcher"; + NullableResponse response = await collection.GetIfExistsAsync(watcherName); + DatabaseWatcherResource 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 + DatabaseWatcherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationCollection.cs new file mode 100644 index 000000000000..056c4f2d59fc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationCollection.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherHealthValidationCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_HealthValidationsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidation_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherHealthValidationResource + DatabaseWatcherHealthValidationCollection collection = databaseWatcher.GetDatabaseWatcherHealthValidations(); + + // invoke the operation + string healthValidationName = "testHealthValidation"; + DatabaseWatcherHealthValidationResource result = await collection.GetAsync(healthValidationName); + + // 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 + DatabaseWatcherHealthValidationData 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_HealthValidationsListByParentMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_ListByParent_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidation_ListByParent" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherHealthValidationResource + DatabaseWatcherHealthValidationCollection collection = databaseWatcher.GetDatabaseWatcherHealthValidations(); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherHealthValidationResource 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 + DatabaseWatcherHealthValidationData 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_HealthValidationsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidation_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherHealthValidationResource + DatabaseWatcherHealthValidationCollection collection = databaseWatcher.GetDatabaseWatcherHealthValidations(); + + // invoke the operation + string healthValidationName = "testHealthValidation"; + bool result = await collection.ExistsAsync(healthValidationName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_HealthValidationsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidation_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherHealthValidationResource + DatabaseWatcherHealthValidationCollection collection = databaseWatcher.GetDatabaseWatcherHealthValidations(); + + // invoke the operation + string healthValidationName = "testHealthValidation"; + NullableResponse response = await collection.GetIfExistsAsync(healthValidationName); + DatabaseWatcherHealthValidationResource 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 + DatabaseWatcherHealthValidationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationResource.cs new file mode 100644 index 000000000000..a2a10c3a1270 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherHealthValidationResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherHealthValidationResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_HealthValidationsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_Get_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidation_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 DatabaseWatcherHealthValidationResource created on azure + // for more information of creating DatabaseWatcherHealthValidationResource, please refer to the document of DatabaseWatcherHealthValidationResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string healthValidationName = "testHealthValidation"; + ResourceIdentifier databaseWatcherHealthValidationResourceId = DatabaseWatcherHealthValidationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, healthValidationName); + DatabaseWatcherHealthValidationResource databaseWatcherHealthValidation = client.GetDatabaseWatcherHealthValidationResource(databaseWatcherHealthValidationResourceId); + + // invoke the operation + DatabaseWatcherHealthValidationResource result = await databaseWatcherHealthValidation.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 + DatabaseWatcherHealthValidationData 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 StartValidation_HealthValidationsStartValidationMaximumSet() + { + // Generated from example definition: 2025-01-02/HealthValidations_StartValidation_MaximumSet_Gen.json + // this example is just showing the usage of "HealthValidations_StartValidation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DatabaseWatcherHealthValidationResource created on azure + // for more information of creating DatabaseWatcherHealthValidationResource, please refer to the document of DatabaseWatcherHealthValidationResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string healthValidationName = "testHealthValidation"; + ResourceIdentifier databaseWatcherHealthValidationResourceId = DatabaseWatcherHealthValidationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, healthValidationName); + DatabaseWatcherHealthValidationResource databaseWatcherHealthValidation = client.GetDatabaseWatcherHealthValidationResource(databaseWatcherHealthValidationResourceId); + + // invoke the operation + ArmOperation lro = await databaseWatcherHealthValidation.StartValidationAsync(WaitUntil.Completed); + DatabaseWatcherHealthValidationResource 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 + DatabaseWatcherHealthValidationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherResource.cs new file mode 100644 index 000000000000..8caa47b21195 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherResource.cs @@ -0,0 +1,172 @@ +// 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.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_WatchersGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "myWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // invoke the operation + DatabaseWatcherResource result = await databaseWatcher.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 + DatabaseWatcherData 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_WatchersDeleteMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // invoke the operation + await databaseWatcher.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_WatchersUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Update_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // invoke the operation + DatabaseWatcherPatch patch = new DatabaseWatcherPatch + { + Identity = new ManagedServiceIdentityV4(ManagedServiceIdentityType.SystemAssigned), + Tags = { }, + Properties = new WatcherUpdateProperties + { + Datastore = new DatabaseWatcherDatastore(new Uri("https://kustouri-adx.eastus.kusto.windows.net"), new Uri("https://ingest-kustouri-adx.eastus.kusto.windows.net"), "kustoDatabaseName1", new Uri("https://portal.azure.com/"), KustoOfferingType.Adx) + { + AdxClusterResourceId = new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest/providers/Microsoft.Kusto/clusters/apiTestKusto"), + KustoClusterDisplayName = "kustoUri-adx", + }, + DefaultAlertRuleIdentityResourceId = new ResourceIdentifier("/subscriptions/469DD77C-C8DB-47B7-B9E1-72D29F8C878B/resourceGroups/rgWatcher/providers/Microsoft.ManagedIdentity/userAssignedIdentities/newtest"), + }, + }; + ArmOperation lro = await databaseWatcher.UpdateAsync(WaitUntil.Completed, patch); + DatabaseWatcherResource 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 + DatabaseWatcherData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Start_WatchersStartMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Start_MaximumSet_Gen.json + // this example is just showing the usage of "Watchers_Start" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // invoke the operation + await databaseWatcher.StartAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Stop_WatchersStopMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_Stop_MaximumSet_Gen.json + // this example is just showing the usage of "Watchers_Stop" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "myWatcher"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // invoke the operation + await databaseWatcher.StopAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResource.cs new file mode 100644 index 000000000000..80c6d1dcf76e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResource.cs @@ -0,0 +1,116 @@ +// 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.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherSharedPrivateLinkResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SharedPrivateLinkResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_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 DatabaseWatcherSharedPrivateLinkResource created on azure + // for more information of creating DatabaseWatcherSharedPrivateLinkResource, please refer to the document of DatabaseWatcherSharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherSharedPrivateLinkResourceId = DatabaseWatcherSharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + DatabaseWatcherSharedPrivateLinkResource databaseWatcherSharedPrivateLinkResource = client.GetDatabaseWatcherSharedPrivateLinkResource(databaseWatcherSharedPrivateLinkResourceId); + + // invoke the operation + DatabaseWatcherSharedPrivateLinkResource result = await databaseWatcherSharedPrivateLinkResource.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 + DatabaseWatcherSharedPrivateLinkResourceData 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_SharedPrivateLinkResourcesDeleteMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_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 DatabaseWatcherSharedPrivateLinkResource created on azure + // for more information of creating DatabaseWatcherSharedPrivateLinkResource, please refer to the document of DatabaseWatcherSharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherSharedPrivateLinkResourceId = DatabaseWatcherSharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + DatabaseWatcherSharedPrivateLinkResource databaseWatcherSharedPrivateLinkResource = client.GetDatabaseWatcherSharedPrivateLinkResource(databaseWatcherSharedPrivateLinkResourceId); + + // invoke the operation + await databaseWatcherSharedPrivateLinkResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SharedPrivateLinkResourcesCreateMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Create_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseWatcherSharedPrivateLinkResource created on azure + // for more information of creating DatabaseWatcherSharedPrivateLinkResource, please refer to the document of DatabaseWatcherSharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherSharedPrivateLinkResourceId = DatabaseWatcherSharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + DatabaseWatcherSharedPrivateLinkResource databaseWatcherSharedPrivateLinkResource = client.GetDatabaseWatcherSharedPrivateLinkResource(databaseWatcherSharedPrivateLinkResourceId); + + // invoke the operation + DatabaseWatcherSharedPrivateLinkResourceData data = new DatabaseWatcherSharedPrivateLinkResourceData + { + Properties = new DatabaseWatcherSharedPrivateLinkResourceProperties(new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), "vault", "request message") + { + DnsZone = "ec3ae9d410ba", + }, + }; + ArmOperation lro = await databaseWatcherSharedPrivateLinkResource.UpdateAsync(WaitUntil.Completed, data); + DatabaseWatcherSharedPrivateLinkResource 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 + DatabaseWatcherSharedPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..ca6db756b35d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherSharedPrivateLinkResourceCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherSharedPrivateLinkResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SharedPrivateLinkResourcesCreateMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Create_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherSharedPrivateLinkResource + DatabaseWatcherSharedPrivateLinkResourceCollection collection = databaseWatcher.GetDatabaseWatcherSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + DatabaseWatcherSharedPrivateLinkResourceData data = new DatabaseWatcherSharedPrivateLinkResourceData + { + Properties = new DatabaseWatcherSharedPrivateLinkResourceProperties(new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), "vault", "request message") + { + DnsZone = "ec3ae9d410ba", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, sharedPrivateLinkResourceName, data); + DatabaseWatcherSharedPrivateLinkResource 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 + DatabaseWatcherSharedPrivateLinkResourceData 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_SharedPrivateLinkResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherSharedPrivateLinkResource + DatabaseWatcherSharedPrivateLinkResourceCollection collection = databaseWatcher.GetDatabaseWatcherSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + DatabaseWatcherSharedPrivateLinkResource result = await collection.GetAsync(sharedPrivateLinkResourceName); + + // 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 + DatabaseWatcherSharedPrivateLinkResourceData 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_SharedPrivateLinkResourcesListByWatcherMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_ListByWatcher_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_ListByWatcher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherSharedPrivateLinkResource + DatabaseWatcherSharedPrivateLinkResourceCollection collection = databaseWatcher.GetDatabaseWatcherSharedPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherSharedPrivateLinkResource 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 + DatabaseWatcherSharedPrivateLinkResourceData 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_SharedPrivateLinkResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherSharedPrivateLinkResource + DatabaseWatcherSharedPrivateLinkResourceCollection collection = databaseWatcher.GetDatabaseWatcherSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + bool result = await collection.ExistsAsync(sharedPrivateLinkResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SharedPrivateLinkResourcesGetMaximumSet() + { + // Generated from example definition: 2025-01-02/SharedPrivateLinkResources_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SharedPrivateLinkResource_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherSharedPrivateLinkResource + DatabaseWatcherSharedPrivateLinkResourceCollection collection = databaseWatcher.GetDatabaseWatcherSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + NullableResponse response = await collection.GetIfExistsAsync(sharedPrivateLinkResourceName); + DatabaseWatcherSharedPrivateLinkResource 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 + DatabaseWatcherSharedPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetCollection.cs new file mode 100644 index 000000000000..c7da2af00ebf --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetCollection.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherTargetCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_TargetsCreateOrUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherTargetResource + DatabaseWatcherTargetCollection collection = databaseWatcher.GetDatabaseWatcherTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + DatabaseWatcherTargetData data = new DatabaseWatcherTargetData + { + Properties = new SqlDBSingleDatabaseTargetProperties(TargetAuthenticationType.Aad, "sqlServero1ihe2", new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2")), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, targetName, data); + DatabaseWatcherTargetResource 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 + DatabaseWatcherTargetData 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_TargetsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherTargetResource + DatabaseWatcherTargetCollection collection = databaseWatcher.GetDatabaseWatcherTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + DatabaseWatcherTargetResource result = await collection.GetAsync(targetName); + + // 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 + DatabaseWatcherTargetData 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_TargetsListByWatcherMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_ListByWatcher_MaximumSet_Gen.json + // this example is just showing the usage of "Target_ListByWatcher" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherTargetResource + DatabaseWatcherTargetCollection collection = databaseWatcher.GetDatabaseWatcherTargets(); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherTargetResource 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 + DatabaseWatcherTargetData 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_TargetsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherTargetResource + DatabaseWatcherTargetCollection collection = databaseWatcher.GetDatabaseWatcherTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + bool result = await collection.ExistsAsync(targetName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_TargetsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherResource created on azure + // for more information of creating DatabaseWatcherResource, please refer to the document of DatabaseWatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier databaseWatcherResourceId = DatabaseWatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + DatabaseWatcherResource databaseWatcher = client.GetDatabaseWatcherResource(databaseWatcherResourceId); + + // get the collection of this DatabaseWatcherTargetResource + DatabaseWatcherTargetCollection collection = databaseWatcher.GetDatabaseWatcherTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + NullableResponse response = await collection.GetIfExistsAsync(targetName); + DatabaseWatcherTargetResource 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 + DatabaseWatcherTargetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetResource.cs new file mode 100644 index 000000000000..fdb0f74c9c8e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_DatabaseWatcherTargetResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.DatabaseWatcher.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.DatabaseWatcher.Samples +{ + public partial class Sample_DatabaseWatcherTargetResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_TargetsGetMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_Get_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherTargetResource created on azure + // for more information of creating DatabaseWatcherTargetResource, please refer to the document of DatabaseWatcherTargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherTargetResourceId = DatabaseWatcherTargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + DatabaseWatcherTargetResource databaseWatcherTarget = client.GetDatabaseWatcherTargetResource(databaseWatcherTargetResourceId); + + // invoke the operation + DatabaseWatcherTargetResource result = await databaseWatcherTarget.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 + DatabaseWatcherTargetData 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_TargetsDeleteMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherTargetResource created on azure + // for more information of creating DatabaseWatcherTargetResource, please refer to the document of DatabaseWatcherTargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherTargetResourceId = DatabaseWatcherTargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + DatabaseWatcherTargetResource databaseWatcherTarget = client.GetDatabaseWatcherTargetResource(databaseWatcherTargetResourceId); + + // invoke the operation + await databaseWatcherTarget.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_TargetsCreateOrUpdateMaximumSet() + { + // Generated from example definition: 2025-01-02/Targets_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "Target_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 DatabaseWatcherTargetResource created on azure + // for more information of creating DatabaseWatcherTargetResource, please refer to the document of DatabaseWatcherTargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier databaseWatcherTargetResourceId = DatabaseWatcherTargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + DatabaseWatcherTargetResource databaseWatcherTarget = client.GetDatabaseWatcherTargetResource(databaseWatcherTargetResourceId); + + // invoke the operation + DatabaseWatcherTargetData data = new DatabaseWatcherTargetData + { + Properties = new SqlDBSingleDatabaseTargetProperties(TargetAuthenticationType.Aad, "sqlServero1ihe2", new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.Sql/servers/m1/databases/m2")), + }; + ArmOperation lro = await databaseWatcherTarget.UpdateAsync(WaitUntil.Completed, data); + DatabaseWatcherTargetResource 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 + DatabaseWatcherTargetData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..5b3a318e5958 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetDatabaseWatchers_WatchersListBySubscriptionMaximumSet() + { + // Generated from example definition: 2025-01-02/Watchers_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "Watcher_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 = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (DatabaseWatcherResource item in subscriptionResource.GetDatabaseWatchersAsync()) + { + // 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 + DatabaseWatcherData 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Azure.ResourceManager.DatabaseWatcher.csproj b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Azure.ResourceManager.DatabaseWatcher.csproj new file mode 100644 index 000000000000..80105c7a5309 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Azure.ResourceManager.DatabaseWatcher.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider DatabaseWatcher. + 1.0.0-beta.1 + azure;management;arm;resource manager;databasewatcher + Azure.ResourceManager.DatabaseWatcher + + diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ArmDatabaseWatcherModelFactory.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ArmDatabaseWatcherModelFactory.cs new file mode 100644 index 000000000000..5c0e760f467f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ArmDatabaseWatcherModelFactory.cs @@ -0,0 +1,312 @@ +// 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.DatabaseWatcher.Models +{ + /// Model factory for models. + public static partial class ArmDatabaseWatcherModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DatabaseWatcherSharedPrivateLinkResourceData DatabaseWatcherSharedPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatabaseWatcherSharedPrivateLinkResourceProperties properties = null) + { + return new DatabaseWatcherSharedPrivateLinkResourceData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource ID of the resource the shared private link resource is for. + /// The group id from the provider of resource the shared private link resource is for. + /// The request message for requesting approval of the shared private link resource. + /// The DNS zone segment to be included in the DNS name of the shared private link. Value is required for Azure Data Explorer clusters and SQL managed instances, and must be omitted for SQL logical servers and key vaults. The value is the second segment of the host FQDN name of the resource that the shared private link resource is for. For example: if the host name is 'adx-cluster-21187695.eastus.kusto.windows.net', then the value is 'eastus'; if the host name is 'sql-mi-23961134.767d5869f605.database.windows.net', then the value is '767d5869f605'. + /// Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + /// The provisioning state of the resource. + /// A new instance for mocking. + public static DatabaseWatcherSharedPrivateLinkResourceProperties DatabaseWatcherSharedPrivateLinkResourceProperties(ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, DatabaseWatcherSharedPrivateLinkResourceStatus? status = null, DatabaseWatcherResourceProvisioningState? provisioningState = null) + { + return new DatabaseWatcherSharedPrivateLinkResourceProperties( + privateLinkResourceId, + groupId, + requestMessage, + dnsZone, + status, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static DatabaseWatcherTargetData DatabaseWatcherTargetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatabaseWatcherTargetProperties properties = null) + { + return new DatabaseWatcherTargetData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// A new instance for mocking. + public static DatabaseWatcherTargetProperties DatabaseWatcherTargetProperties(string targetType = null, TargetAuthenticationType targetAuthenticationType = default, TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, DatabaseWatcherResourceProvisioningState? provisioningState = null) + { + return new UnknownDatabaseWatcherTargetProperties( + targetType, + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// The Azure resource ID of an Azure SQL DB database target. + /// Set to true to monitor a high availability replica of specified target, if any. + /// A new instance for mocking. + public static SqlDBSingleDatabaseTargetProperties SqlDBSingleDatabaseTargetProperties(TargetAuthenticationType targetAuthenticationType = default, TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, DatabaseWatcherResourceProvisioningState? provisioningState = null, ResourceIdentifier sqlDbResourceId = null, bool? readIntent = null) + { + return new SqlDBSingleDatabaseTargetProperties( + "SqlDb", + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData: null, + sqlDbResourceId, + readIntent); + } + + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// The Azure resource ID of an Azure SQL DB elastic pool target. + /// The Azure resource ID of the anchor database used to connect to an elastic pool. + /// Set to true to monitor a high availability replica of specified target, if any. + /// A new instance for mocking. + public static SqlDBElasticPoolTargetProperties SqlDBElasticPoolTargetProperties(TargetAuthenticationType targetAuthenticationType = default, TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, DatabaseWatcherResourceProvisioningState? provisioningState = null, ResourceIdentifier sqlEpResourceId = null, ResourceIdentifier anchorDatabaseResourceId = null, bool? readIntent = null) + { + return new SqlDBElasticPoolTargetProperties( + "SqlEp", + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData: null, + sqlEpResourceId, + anchorDatabaseResourceId, + readIntent); + } + + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// The Azure resource ID of an Azure SQL Managed Instance target. + /// The TCP port number to optionally use in the connection string when connecting to an Azure SQL Managed Instance target. + /// Set to true to monitor a high availability replica of specified target, if any. + /// A new instance for mocking. + public static SqlMITargetProperties SqlMITargetProperties(TargetAuthenticationType targetAuthenticationType = default, TargetAuthenticationVaultSecret targetVault = null, string connectionServerName = null, DatabaseWatcherResourceProvisioningState? provisioningState = null, ResourceIdentifier sqlMiResourceId = null, int? connectionTcpPort = null, bool? readIntent = null) + { + return new SqlMITargetProperties( + "SqlMi", + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData: null, + sqlMiResourceId, + connectionTcpPort, + readIntent); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DatabaseWatcherHealthValidationData DatabaseWatcherHealthValidationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatabaseWatcherHealthValidationProperties properties = null) + { + return new DatabaseWatcherHealthValidationData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The start time of health validation, in UTC. + /// The end time of health validation, in UTC. + /// The current health validation status. + /// The list of issues found by health validation. + /// The provisioning state of the health validation resource. + /// A new instance for mocking. + public static DatabaseWatcherHealthValidationProperties DatabaseWatcherHealthValidationProperties(DateTimeOffset startOn = default, DateTimeOffset endOn = default, DatabaseWatcherHealthValidationStatus status = default, IEnumerable issues = null, DatabaseWatcherResourceProvisioningState? provisioningState = null) + { + issues ??= new List(); + + return new DatabaseWatcherHealthValidationProperties( + startOn, + endOn, + status, + issues?.ToList(), + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The error code of the issue. + /// The error message of the issue. + /// The additional details for the issue. + /// The recommendation for resolving the issue. + /// The URL related to resolving the issue. + /// The resource ID of the Azure resource related to the issue. + /// The type of the Azure resource related to the issue. + /// A new instance for mocking. + public static DatabaseWatcherHealthValidationIssue DatabaseWatcherHealthValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, Uri recommendationUri = null, ResourceIdentifier relatedResourceId = null, ResourceType? relatedResourceType = null) + { + return new DatabaseWatcherHealthValidationIssue( + errorCode, + errorMessage, + additionalDetails, + recommendationMessage, + recommendationUri, + relatedResourceId, + relatedResourceType, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static DatabaseWatcherAlertRuleData DatabaseWatcherAlertRuleData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DatabaseWatcherAlertRuleProperties properties = null) + { + return new DatabaseWatcherAlertRuleData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource ID of the alert rule resource. + /// The properties with which the alert rule resource was created. + /// The creation time of the alert rule resource. + /// The provisioning state of the alert rule resource. + /// The template ID associated with alert rule resource. + /// The alert rule template version. + /// A new instance for mocking. + public static DatabaseWatcherAlertRuleProperties DatabaseWatcherAlertRuleProperties(ResourceIdentifier alertRuleResourceId = null, AlertRuleCreationProperty createdWithProperties = default, DateTimeOffset createdOn = default, DatabaseWatcherResourceProvisioningState? provisioningState = null, string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) + { + return new DatabaseWatcherAlertRuleProperties( + alertRuleResourceId, + createdWithProperties, + createdOn, + provisioningState, + alertRuleTemplateId, + alertRuleTemplateVersion, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static DatabaseWatcherData DatabaseWatcherData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DatabaseWatcherProperties properties = null, ManagedServiceIdentityV4 identity = null) + { + tags ??= new Dictionary(); + + return new DatabaseWatcherData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The data store for collected monitoring data. + /// The monitoring collection status of the watcher. + /// The provisioning state of the resource watcher. + /// The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + /// A new instance for mocking. + public static DatabaseWatcherProperties DatabaseWatcherProperties(DatabaseWatcherDatastore datastore = null, DatabaseWatcherStatus? status = null, DatabaseWatcherProvisioningState? provisioningState = null, ResourceIdentifier defaultAlertRuleIdentityResourceId = null) + { + return new DatabaseWatcherProperties(datastore, status, provisioningState, defaultAlertRuleIdentityResourceId, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The type of managed identity assigned to this resource. + /// The identities assigned to this resource by the user. + /// A new instance for mocking. + public static ManagedServiceIdentityV4 ManagedServiceIdentityV4(Guid? principalId = null, Guid? tenantId = null, ManagedServiceIdentityType type = default, IDictionary userAssignedIdentities = null) + { + userAssignedIdentities ??= new Dictionary(); + + return new ManagedServiceIdentityV4(principalId, tenantId, type, userAssignedIdentities, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleCollection.cs new file mode 100644 index 000000000000..ea81ae0c8683 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatabaseWatcherAlertRules method from an instance of . + /// + public partial class DatabaseWatcherAlertRuleCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics; + private readonly AlertRuleResourcesRestOperations _databaseWatcherAlertRuleAlertRuleResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherAlertRuleCollection() + { + } + + /// 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 DatabaseWatcherAlertRuleCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherAlertRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseWatcherAlertRuleResource.ResourceType, out string databaseWatcherAlertRuleAlertRuleResourcesApiVersion); + _databaseWatcherAlertRuleAlertRuleResourcesRestClient = new AlertRuleResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherAlertRuleAlertRuleResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseWatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseWatcherResource.ResourceType), nameof(id)); + } + + /// + /// Create a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 alert rule proxy resource name. + /// 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 alertRuleResourceName, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 alert rule proxy resource name. + /// 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 alertRuleResourceName, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data, cancellationToken); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.Get"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List AlertRuleResource resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources + /// + /// + /// Operation Id + /// AlertRuleResource_ListByParent + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherAlertRuleResource(Client, DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(e)), _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics, Pipeline, "DatabaseWatcherAlertRuleCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List AlertRuleResource resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources + /// + /// + /// Operation Id + /// AlertRuleResource_ListByParent + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherAlertRuleResource(Client, DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(e)), _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics, Pipeline, "DatabaseWatcherAlertRuleCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, 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.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.Exists"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, 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.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(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.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.Serialization.cs new file mode 100644 index 000000000000..859f9aa06241 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherAlertRuleData : 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(DatabaseWatcherAlertRuleData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DatabaseWatcherAlertRuleData 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(DatabaseWatcherAlertRuleData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherAlertRuleData(document.RootElement, options); + } + + internal static DatabaseWatcherAlertRuleData DeserializeDatabaseWatcherAlertRuleData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherAlertRuleProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DatabaseWatcherAlertRuleProperties.DeserializeDatabaseWatcherAlertRuleProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherAlertRuleData( + id, + name, + type, + systemData, + 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(DatabaseWatcherAlertRuleData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherAlertRuleData 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 DeserializeDatabaseWatcherAlertRuleData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherAlertRuleData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.cs new file mode 100644 index 000000000000..bf437fd51e74 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleData.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; +using Azure.Core; +using Azure.ResourceManager.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing the DatabaseWatcherAlertRule data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class DatabaseWatcherAlertRuleData : 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 DatabaseWatcherAlertRuleData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherAlertRuleData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatabaseWatcherAlertRuleProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DatabaseWatcherAlertRuleProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.Serialization.cs new file mode 100644 index 000000000000..bd4b305af2e7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.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.DatabaseWatcher +{ + public partial class DatabaseWatcherAlertRuleResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatabaseWatcherAlertRuleData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatabaseWatcherAlertRuleData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.cs new file mode 100644 index 000000000000..ba6e5d92a404 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherAlertRuleResource.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A Class representing a DatabaseWatcherAlertRule along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatabaseWatcherAlertRuleResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseWatcherAlertRule method. + /// + public partial class DatabaseWatcherAlertRuleResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The watcherName. + /// The alertRuleResourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics; + private readonly AlertRuleResourcesRestOperations _databaseWatcherAlertRuleAlertRuleResourcesRestClient; + private readonly DatabaseWatcherAlertRuleData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DatabaseWatcher/watchers/alertRuleResources"; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherAlertRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseWatcherAlertRuleResource(ArmClient client, DatabaseWatcherAlertRuleData 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 DatabaseWatcherAlertRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseWatcherAlertRuleAlertRuleResourcesApiVersion); + _databaseWatcherAlertRuleAlertRuleResourcesRestClient = new AlertRuleResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherAlertRuleAlertRuleResourcesApiVersion); +#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 DatabaseWatcherAlertRuleData 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 AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Get"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Delete"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Delete"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Update"); + scope.Start(); + try + { + var response = await _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherAlertRuleAlertRuleResourcesClientDiagnostics.CreateScope("DatabaseWatcherAlertRuleResource.Update"); + scope.Start(); + try + { + var response = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _databaseWatcherAlertRuleAlertRuleResourcesRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherAlertRuleResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherCollection.cs new file mode 100644 index 000000000000..0bff50e0233d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherCollection.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.DatabaseWatcher +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatabaseWatchers method from an instance of . + /// + public partial class DatabaseWatcherCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseWatcherWatchersClientDiagnostics; + private readonly WatchersRestOperations _databaseWatcherWatchersRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherCollection() + { + } + + /// 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 DatabaseWatcherCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherWatchersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseWatcherResource.ResourceType, out string databaseWatcherWatchersApiVersion); + _databaseWatcherWatchersRestClient = new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherWatchersApiVersion); +#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 Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 database watcher name. + /// 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 watcherName, DatabaseWatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherOperationSource(Client), _databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, watcherName, 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 Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 database watcher name. + /// 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 watcherName, DatabaseWatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, watcherName, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherOperationSource(Client), _databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, watcherName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.Get"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Watcher resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherWatchersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherWatchersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherResource(Client, DatabaseWatcherData.DeserializeDatabaseWatcherData(e)), _databaseWatcherWatchersClientDiagnostics, Pipeline, "DatabaseWatcherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Watcher resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherWatchersRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherWatchersRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherResource(Client, DatabaseWatcherData.DeserializeDatabaseWatcherData(e)), _databaseWatcherWatchersClientDiagnostics, Pipeline, "DatabaseWatcherCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, 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.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.Exists"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, watcherName, 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.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(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.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.Serialization.cs new file mode 100644 index 000000000000..36a6dfccd815 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.Serialization.cs @@ -0,0 +1,194 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherData : 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(DatabaseWatcherData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + } + + DatabaseWatcherData 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(DatabaseWatcherData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherData(document.RootElement, options); + } + + internal static DatabaseWatcherData DeserializeDatabaseWatcherData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherProperties properties = default; + ManagedServiceIdentityV4 identity = 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 = DatabaseWatcherProperties.DeserializeDatabaseWatcherProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ManagedServiceIdentityV4.DeserializeManagedServiceIdentityV4(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 DatabaseWatcherData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + 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(DatabaseWatcherData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherData 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 DeserializeDatabaseWatcherData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.cs new file mode 100644 index 000000000000..4376c547a398 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherData.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing the DatabaseWatcher data model. + /// The DatabaseWatcherProviderHub resource. + /// + public partial class DatabaseWatcherData : 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 DatabaseWatcherData(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. + /// The managed service identities assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, DatabaseWatcherProperties properties, ManagedServiceIdentityV4 identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherData() + { + } + + /// The resource-specific properties for this resource. + public DatabaseWatcherProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentityV4 Identity { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationCollection.cs new file mode 100644 index 000000000000..27adf21f3f21 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationCollection.cs @@ -0,0 +1,395 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatabaseWatcherHealthValidations method from an instance of . + /// + public partial class DatabaseWatcherHealthValidationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseWatcherHealthValidationHealthValidationsClientDiagnostics; + private readonly HealthValidationsRestOperations _databaseWatcherHealthValidationHealthValidationsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherHealthValidationCollection() + { + } + + /// 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 DatabaseWatcherHealthValidationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherHealthValidationHealthValidationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherHealthValidationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseWatcherHealthValidationResource.ResourceType, out string databaseWatcherHealthValidationHealthValidationsApiVersion); + _databaseWatcherHealthValidationHealthValidationsRestClient = new HealthValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherHealthValidationHealthValidationsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseWatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseWatcherResource.ResourceType), nameof(id)); + } + + /// + /// Get a HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherHealthValidationHealthValidationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.Get"); + scope.Start(); + try + { + var response = _databaseWatcherHealthValidationHealthValidationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List HealthValidation resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations + /// + /// + /// Operation Id + /// HealthValidation_ListByParent + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherHealthValidationHealthValidationsRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherHealthValidationHealthValidationsRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherHealthValidationResource(Client, DatabaseWatcherHealthValidationData.DeserializeDatabaseWatcherHealthValidationData(e)), _databaseWatcherHealthValidationHealthValidationsClientDiagnostics, Pipeline, "DatabaseWatcherHealthValidationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List HealthValidation resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations + /// + /// + /// Operation Id + /// HealthValidation_ListByParent + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherHealthValidationHealthValidationsRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherHealthValidationHealthValidationsRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherHealthValidationResource(Client, DatabaseWatcherHealthValidationData.DeserializeDatabaseWatcherHealthValidationData(e)), _databaseWatcherHealthValidationHealthValidationsClientDiagnostics, Pipeline, "DatabaseWatcherHealthValidationCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseWatcherHealthValidationHealthValidationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, 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.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.Exists"); + scope.Start(); + try + { + var response = _databaseWatcherHealthValidationHealthValidationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, 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.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseWatcherHealthValidationHealthValidationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(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.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseWatcherHealthValidationHealthValidationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.Serialization.cs new file mode 100644 index 000000000000..e84864d7bae0 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherHealthValidationData : 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(DatabaseWatcherHealthValidationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DatabaseWatcherHealthValidationData 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(DatabaseWatcherHealthValidationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherHealthValidationData(document.RootElement, options); + } + + internal static DatabaseWatcherHealthValidationData DeserializeDatabaseWatcherHealthValidationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherHealthValidationProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DatabaseWatcherHealthValidationProperties.DeserializeDatabaseWatcherHealthValidationProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherHealthValidationData( + id, + name, + type, + systemData, + 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(DatabaseWatcherHealthValidationData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherHealthValidationData 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 DeserializeDatabaseWatcherHealthValidationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherHealthValidationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.cs new file mode 100644 index 000000000000..8aae4fbefd1d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationData.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; +using Azure.Core; +using Azure.ResourceManager.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing the DatabaseWatcherHealthValidation data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class DatabaseWatcherHealthValidationData : 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 . + internal DatabaseWatcherHealthValidationData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherHealthValidationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatabaseWatcherHealthValidationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DatabaseWatcherHealthValidationProperties Properties { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.Serialization.cs new file mode 100644 index 000000000000..fe4d14b2407f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.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.DatabaseWatcher +{ + public partial class DatabaseWatcherHealthValidationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatabaseWatcherHealthValidationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatabaseWatcherHealthValidationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.cs new file mode 100644 index 000000000000..12494a0aee91 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherHealthValidationResource.cs @@ -0,0 +1,255 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A Class representing a DatabaseWatcherHealthValidation along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatabaseWatcherHealthValidationResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseWatcherHealthValidation method. + /// + public partial class DatabaseWatcherHealthValidationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The watcherName. + /// The healthValidationName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseWatcherHealthValidationHealthValidationsClientDiagnostics; + private readonly HealthValidationsRestOperations _databaseWatcherHealthValidationHealthValidationsRestClient; + private readonly DatabaseWatcherHealthValidationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DatabaseWatcher/watchers/healthValidations"; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherHealthValidationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseWatcherHealthValidationResource(ArmClient client, DatabaseWatcherHealthValidationData 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 DatabaseWatcherHealthValidationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherHealthValidationHealthValidationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseWatcherHealthValidationHealthValidationsApiVersion); + _databaseWatcherHealthValidationHealthValidationsRestClient = new HealthValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherHealthValidationHealthValidationsApiVersion); +#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 DatabaseWatcherHealthValidationData 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 HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationResource.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherHealthValidationHealthValidationsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationResource.Get"); + scope.Start(); + try + { + var response = _databaseWatcherHealthValidationHealthValidationsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherHealthValidationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Starts health validation for a watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName}/startValidation + /// + /// + /// Operation Id + /// HealthValidations_StartValidation + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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> StartValidationAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationResource.StartValidation"); + scope.Start(); + try + { + var response = await _databaseWatcherHealthValidationHealthValidationsRestClient.StartValidationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherHealthValidationOperationSource(Client), _databaseWatcherHealthValidationHealthValidationsClientDiagnostics, Pipeline, _databaseWatcherHealthValidationHealthValidationsRestClient.CreateStartValidationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, 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; + } + } + + /// + /// Starts health validation for a watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName}/startValidation + /// + /// + /// Operation Id + /// HealthValidations_StartValidation + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 StartValidation(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherHealthValidationHealthValidationsClientDiagnostics.CreateScope("DatabaseWatcherHealthValidationResource.StartValidation"); + scope.Start(); + try + { + var response = _databaseWatcherHealthValidationHealthValidationsRestClient.StartValidation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherHealthValidationOperationSource(Client), _databaseWatcherHealthValidationHealthValidationsClientDiagnostics, Pipeline, _databaseWatcherHealthValidationHealthValidationsRestClient.CreateStartValidationRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.Serialization.cs new file mode 100644 index 000000000000..4cd91483db6d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.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.DatabaseWatcher +{ + public partial class DatabaseWatcherResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatabaseWatcherData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatabaseWatcherData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.cs new file mode 100644 index 000000000000..099931e03d1a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherResource.cs @@ -0,0 +1,1151 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A Class representing a DatabaseWatcher along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatabaseWatcherResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseWatcher method. + /// + public partial class DatabaseWatcherResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The watcherName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseWatcherWatchersClientDiagnostics; + private readonly WatchersRestOperations _databaseWatcherWatchersRestClient; + private readonly DatabaseWatcherData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DatabaseWatcher/watchers"; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseWatcherResource(ArmClient client, DatabaseWatcherData 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 DatabaseWatcherResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherWatchersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseWatcherWatchersApiVersion); + _databaseWatcherWatchersRestClient = new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherWatchersApiVersion); +#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 DatabaseWatcherData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DatabaseWatcherAlertRuleResources in the DatabaseWatcher. + /// An object representing collection of DatabaseWatcherAlertRuleResources and their operations over a DatabaseWatcherAlertRuleResource. + public virtual DatabaseWatcherAlertRuleCollection GetDatabaseWatcherAlertRules() + { + return GetCachedClient(client => new DatabaseWatcherAlertRuleCollection(client, Id)); + } + + /// + /// Get a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseWatcherAlertRuleAsync(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + return await GetDatabaseWatcherAlertRules().GetAsync(alertRuleResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AlertRuleResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/alertRuleResources/{alertRuleResourceName} + /// + /// + /// Operation Id + /// AlertRuleResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The alert rule proxy resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseWatcherAlertRule(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + return GetDatabaseWatcherAlertRules().Get(alertRuleResourceName, cancellationToken); + } + + /// Gets a collection of DatabaseWatcherHealthValidationResources in the DatabaseWatcher. + /// An object representing collection of DatabaseWatcherHealthValidationResources and their operations over a DatabaseWatcherHealthValidationResource. + public virtual DatabaseWatcherHealthValidationCollection GetDatabaseWatcherHealthValidations() + { + return GetCachedClient(client => new DatabaseWatcherHealthValidationCollection(client, Id)); + } + + /// + /// Get a HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseWatcherHealthValidationAsync(string healthValidationName, CancellationToken cancellationToken = default) + { + return await GetDatabaseWatcherHealthValidations().GetAsync(healthValidationName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a HealthValidation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/healthValidations/{healthValidationName} + /// + /// + /// Operation Id + /// HealthValidation_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The health validation resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseWatcherHealthValidation(string healthValidationName, CancellationToken cancellationToken = default) + { + return GetDatabaseWatcherHealthValidations().Get(healthValidationName, cancellationToken); + } + + /// Gets a collection of DatabaseWatcherTargetResources in the DatabaseWatcher. + /// An object representing collection of DatabaseWatcherTargetResources and their operations over a DatabaseWatcherTargetResource. + public virtual DatabaseWatcherTargetCollection GetDatabaseWatcherTargets() + { + return GetCachedClient(client => new DatabaseWatcherTargetCollection(client, Id)); + } + + /// + /// Get a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseWatcherTargetAsync(string targetName, CancellationToken cancellationToken = default) + { + return await GetDatabaseWatcherTargets().GetAsync(targetName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseWatcherTarget(string targetName, CancellationToken cancellationToken = default) + { + return GetDatabaseWatcherTargets().Get(targetName, cancellationToken); + } + + /// Gets a collection of DatabaseWatcherSharedPrivateLinkResources in the DatabaseWatcher. + /// An object representing collection of DatabaseWatcherSharedPrivateLinkResources and their operations over a DatabaseWatcherSharedPrivateLinkResource. + public virtual DatabaseWatcherSharedPrivateLinkResourceCollection GetDatabaseWatcherSharedPrivateLinkResources() + { + return GetCachedClient(client => new DatabaseWatcherSharedPrivateLinkResourceCollection(client, Id)); + } + + /// + /// Get a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseWatcherSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + return await GetDatabaseWatcherSharedPrivateLinkResources().GetAsync(sharedPrivateLinkResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseWatcherSharedPrivateLinkResource(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + return GetDatabaseWatcherSharedPrivateLinkResources().Get(sharedPrivateLinkResourceName, cancellationToken); + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Get"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Delete"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.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 Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Delete"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.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 Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Update + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseWatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Update"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherOperationSource(Client), _databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Update + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseWatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Update"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherOperationSource(Client), _databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The action to start monitoring all targets configured for a database watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/start + /// + /// + /// Operation Id + /// Watchers_Start + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task StartAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Start"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The action to start monitoring all targets configured for a database watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/start + /// + /// + /// Operation Id + /// Watchers_Start + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Start(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Start"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateStartRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The action to stop monitoring all targets configured for a database watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/stop + /// + /// + /// Operation Id + /// Watchers_Stop + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task StopAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Stop"); + scope.Start(); + try + { + var response = await _databaseWatcherWatchersRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// The action to stop monitoring all targets configured for a database watcher. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/stop + /// + /// + /// Operation Id + /// Watchers_Stop + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Stop(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.Stop"); + scope.Start(); + try + { + var response = _databaseWatcherWatchersRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherWatchersClientDiagnostics, Pipeline, _databaseWatcherWatchersRestClient.CreateStopRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseWatcherPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseWatcherPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseWatcherPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseWatcherPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 _databaseWatcherWatchersRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new DatabaseWatcherPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherWatchersClientDiagnostics.CreateScope("DatabaseWatcherResource.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 = _databaseWatcherWatchersRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new DatabaseWatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new DatabaseWatcherPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.Serialization.cs new file mode 100644 index 000000000000..42cb61cdb2f1 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.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.DatabaseWatcher +{ + public partial class DatabaseWatcherSharedPrivateLinkResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatabaseWatcherSharedPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatabaseWatcherSharedPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.cs new file mode 100644 index 000000000000..a612dc5c6e80 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResource.cs @@ -0,0 +1,347 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A Class representing a DatabaseWatcherSharedPrivateLinkResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatabaseWatcherSharedPrivateLinkResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseWatcherSharedPrivateLinkResource method. + /// + public partial class DatabaseWatcherSharedPrivateLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The watcherName. + /// The sharedPrivateLinkResourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics; + private readonly SharedPrivateLinkResourcesRestOperations _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient; + private readonly DatabaseWatcherSharedPrivateLinkResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DatabaseWatcher/watchers/sharedPrivateLinkResources"; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherSharedPrivateLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseWatcherSharedPrivateLinkResource(ArmClient client, DatabaseWatcherSharedPrivateLinkResourceData 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 DatabaseWatcherSharedPrivateLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesApiVersion); + _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient = new SharedPrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesApiVersion); +#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 DatabaseWatcherSharedPrivateLinkResourceData 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 SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Delete"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Delete"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Create + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Update"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherSharedPrivateLinkResourceOperationSource(Client), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, 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 SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Create + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResource.Update"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherSharedPrivateLinkResourceOperationSource(Client), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..9ff1f3914249 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceCollection.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatabaseWatcherSharedPrivateLinkResources method from an instance of . + /// + public partial class DatabaseWatcherSharedPrivateLinkResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics; + private readonly SharedPrivateLinkResourcesRestOperations _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherSharedPrivateLinkResourceCollection() + { + } + + /// 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 DatabaseWatcherSharedPrivateLinkResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherSharedPrivateLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseWatcherSharedPrivateLinkResource.ResourceType, out string databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesApiVersion); + _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient = new SharedPrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseWatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseWatcherResource.ResourceType), nameof(id)); + } + + /// + /// Create a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Create + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 Shared Private Link resource name. + /// 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 sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherSharedPrivateLinkResourceOperationSource(Client), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, 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 SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Create + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 Shared Private Link resource name. + /// 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 sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new DatabaseWatcherSharedPrivateLinkResourceOperationSource(Client), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a SharedPrivateLinkResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List SharedPrivateLinkResource resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_ListByWatcher + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherSharedPrivateLinkResource(Client, DatabaseWatcherSharedPrivateLinkResourceData.DeserializeDatabaseWatcherSharedPrivateLinkResourceData(e)), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, "DatabaseWatcherSharedPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List SharedPrivateLinkResource resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_ListByWatcher + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherSharedPrivateLinkResource(Client, DatabaseWatcherSharedPrivateLinkResourceData.DeserializeDatabaseWatcherSharedPrivateLinkResourceData(e)), _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics, Pipeline, "DatabaseWatcherSharedPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, 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.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, 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.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(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.DatabaseWatcher/watchers/{watcherName}/sharedPrivateLinkResources/{sharedPrivateLinkResourceName} + /// + /// + /// Operation Id + /// SharedPrivateLinkResource_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The Shared Private Link resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var scope = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesClientDiagnostics.CreateScope("DatabaseWatcherSharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseWatcherSharedPrivateLinkResourceSharedPrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherSharedPrivateLinkResource(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..cee5857b3c7f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherSharedPrivateLinkResourceData : 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(DatabaseWatcherSharedPrivateLinkResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DatabaseWatcherSharedPrivateLinkResourceData 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(DatabaseWatcherSharedPrivateLinkResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherSharedPrivateLinkResourceData(document.RootElement, options); + } + + internal static DatabaseWatcherSharedPrivateLinkResourceData DeserializeDatabaseWatcherSharedPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherSharedPrivateLinkResourceProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DatabaseWatcherSharedPrivateLinkResourceProperties.DeserializeDatabaseWatcherSharedPrivateLinkResourceProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherSharedPrivateLinkResourceData( + id, + name, + type, + systemData, + 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(DatabaseWatcherSharedPrivateLinkResourceData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherSharedPrivateLinkResourceData 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 DeserializeDatabaseWatcherSharedPrivateLinkResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherSharedPrivateLinkResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.cs new file mode 100644 index 000000000000..1d5c00501987 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherSharedPrivateLinkResourceData.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; +using Azure.Core; +using Azure.ResourceManager.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing the DatabaseWatcherSharedPrivateLinkResource data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class DatabaseWatcherSharedPrivateLinkResourceData : 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 DatabaseWatcherSharedPrivateLinkResourceData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherSharedPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatabaseWatcherSharedPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public DatabaseWatcherSharedPrivateLinkResourceProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetCollection.cs new file mode 100644 index 000000000000..8f123e9e4ce0 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDatabaseWatcherTargets method from an instance of . + /// + public partial class DatabaseWatcherTargetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _databaseWatcherTargetTargetsClientDiagnostics; + private readonly TargetsRestOperations _databaseWatcherTargetTargetsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherTargetCollection() + { + } + + /// 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 DatabaseWatcherTargetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherTargetTargetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherTargetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DatabaseWatcherTargetResource.ResourceType, out string databaseWatcherTargetTargetsApiVersion); + _databaseWatcherTargetTargetsRestClient = new TargetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherTargetTargetsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != DatabaseWatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, DatabaseWatcherResource.ResourceType), nameof(id)); + } + + /// + /// Create a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 target resource name. + /// 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 targetName, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherTargetTargetsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherTargetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 target resource name. + /// 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 targetName, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data, cancellationToken); + var uri = _databaseWatcherTargetTargetsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherTargetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.Get"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Target resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets + /// + /// + /// Operation Id + /// Target_ListByWatcher + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherTargetTargetsRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherTargetTargetsRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherTargetResource(Client, DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(e)), _databaseWatcherTargetTargetsClientDiagnostics, Pipeline, "DatabaseWatcherTargetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Target resources by Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets + /// + /// + /// Operation Id + /// Target_ListByWatcher + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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) => _databaseWatcherTargetTargetsRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _databaseWatcherTargetTargetsRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherTargetResource(Client, DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(e)), _databaseWatcherTargetTargetsClientDiagnostics, Pipeline, "DatabaseWatcherTargetCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.Exists"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, 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.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.Exists"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, 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.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(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.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The target resource name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.Serialization.cs new file mode 100644 index 000000000000..fda12d1a8340 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + public partial class DatabaseWatcherTargetData : 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(DatabaseWatcherTargetData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + DatabaseWatcherTargetData 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(DatabaseWatcherTargetData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherTargetData(document.RootElement, options); + } + + internal static DatabaseWatcherTargetData DeserializeDatabaseWatcherTargetData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherTargetProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = DatabaseWatcherTargetProperties.DeserializeDatabaseWatcherTargetProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherTargetData( + id, + name, + type, + systemData, + 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(DatabaseWatcherTargetData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherTargetData 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 DeserializeDatabaseWatcherTargetData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherTargetData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.cs new file mode 100644 index 000000000000..6dd1c1056cc7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetData.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.DatabaseWatcher.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A class representing the DatabaseWatcherTarget data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class DatabaseWatcherTargetData : 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 DatabaseWatcherTargetData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherTargetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DatabaseWatcherTargetProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The resource-specific properties for this resource. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public DatabaseWatcherTargetProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.Serialization.cs new file mode 100644 index 000000000000..89f3364f30ec --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.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.DatabaseWatcher +{ + public partial class DatabaseWatcherTargetResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DatabaseWatcherTargetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DatabaseWatcherTargetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.cs new file mode 100644 index 000000000000..12e73b59504f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/DatabaseWatcherTargetResource.cs @@ -0,0 +1,355 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// + /// A Class representing a DatabaseWatcherTarget along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDatabaseWatcherTargetResource method. + /// Otherwise you can get one from its parent resource using the GetDatabaseWatcherTarget method. + /// + public partial class DatabaseWatcherTargetResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The watcherName. + /// The targetName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string watcherName, string targetName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _databaseWatcherTargetTargetsClientDiagnostics; + private readonly TargetsRestOperations _databaseWatcherTargetTargetsRestClient; + private readonly DatabaseWatcherTargetData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.DatabaseWatcher/watchers/targets"; + + /// Initializes a new instance of the class for mocking. + protected DatabaseWatcherTargetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DatabaseWatcherTargetResource(ArmClient client, DatabaseWatcherTargetData 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 DatabaseWatcherTargetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _databaseWatcherTargetTargetsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string databaseWatcherTargetTargetsApiVersion); + _databaseWatcherTargetTargetsRestClient = new TargetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, databaseWatcherTargetTargetsApiVersion); +#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 DatabaseWatcherTargetData 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 Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Get"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Get"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DatabaseWatcherTargetResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Delete"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherTargetTargetsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_Delete + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Delete"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _databaseWatcherTargetTargetsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Update"); + scope.Start(); + try + { + var response = await _databaseWatcherTargetTargetsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _databaseWatcherTargetTargetsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherTargetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Target + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName}/targets/{targetName} + /// + /// + /// Operation Id + /// Target_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _databaseWatcherTargetTargetsClientDiagnostics.CreateScope("DatabaseWatcherTargetResource.Update"); + scope.Start(); + try + { + var response = _databaseWatcherTargetTargetsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _databaseWatcherTargetTargetsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new DatabaseWatcherArmOperation(Response.FromValue(new DatabaseWatcherTargetResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/DatabaseWatcherExtensions.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/DatabaseWatcherExtensions.cs new file mode 100644 index 000000000000..6afb25cd9e8f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/DatabaseWatcherExtensions.cs @@ -0,0 +1,295 @@ +// 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.DatabaseWatcher.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + /// A class to add extension methods to Azure.ResourceManager.DatabaseWatcher. + public static partial class DatabaseWatcherExtensions + { + private static MockableDatabaseWatcherArmClient GetMockableDatabaseWatcherArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableDatabaseWatcherArmClient(client0)); + } + + private static MockableDatabaseWatcherResourceGroupResource GetMockableDatabaseWatcherResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDatabaseWatcherResourceGroupResource(client, resource.Id)); + } + + private static MockableDatabaseWatcherSubscriptionResource GetMockableDatabaseWatcherSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableDatabaseWatcherSubscriptionResource(client, resource.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 DatabaseWatcherResource GetDatabaseWatcherResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetDatabaseWatcherResource(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 DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetDatabaseWatcherAlertRuleResource(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 DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetDatabaseWatcherHealthValidationResource(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 DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetDatabaseWatcherTargetResource(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 DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetDatabaseWatcherSharedPrivateLinkResource(id); + } + + /// + /// Gets a collection of DatabaseWatcherResources 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 DatabaseWatcherResources and their operations over a DatabaseWatcherResource. + public static DatabaseWatcherCollection GetDatabaseWatchers(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetDatabaseWatchers(); + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The database watcher name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDatabaseWatcherAsync(this ResourceGroupResource resourceGroupResource, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetDatabaseWatcherAsync(watcherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The database watcher name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDatabaseWatcher(this ResourceGroupResource resourceGroupResource, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetDatabaseWatcher(watcherName, cancellationToken); + } + + /// + /// List Watcher resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 GetDatabaseWatchersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDatabaseWatcherSubscriptionResource(subscriptionResource).GetDatabaseWatchersAsync(cancellationToken); + } + + /// + /// List Watcher resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// 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 GetDatabaseWatchers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDatabaseWatcherSubscriptionResource(subscriptionResource).GetDatabaseWatchers(cancellationToken); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherArmClient.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherArmClient.cs new file mode 100644 index 000000000000..19aa6740f0fb --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherArmClient.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableDatabaseWatcherArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDatabaseWatcherArmClient() + { + } + + /// 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 MockableDatabaseWatcherArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableDatabaseWatcherArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// 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 DatabaseWatcherResource GetDatabaseWatcherResource(ResourceIdentifier id) + { + DatabaseWatcherResource.ValidateResourceId(id); + return new DatabaseWatcherResource(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 DatabaseWatcherAlertRuleResource GetDatabaseWatcherAlertRuleResource(ResourceIdentifier id) + { + DatabaseWatcherAlertRuleResource.ValidateResourceId(id); + return new DatabaseWatcherAlertRuleResource(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 DatabaseWatcherHealthValidationResource GetDatabaseWatcherHealthValidationResource(ResourceIdentifier id) + { + DatabaseWatcherHealthValidationResource.ValidateResourceId(id); + return new DatabaseWatcherHealthValidationResource(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 DatabaseWatcherTargetResource GetDatabaseWatcherTargetResource(ResourceIdentifier id) + { + DatabaseWatcherTargetResource.ValidateResourceId(id); + return new DatabaseWatcherTargetResource(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 DatabaseWatcherSharedPrivateLinkResource GetDatabaseWatcherSharedPrivateLinkResource(ResourceIdentifier id) + { + DatabaseWatcherSharedPrivateLinkResource.ValidateResourceId(id); + return new DatabaseWatcherSharedPrivateLinkResource(Client, id); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherResourceGroupResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherResourceGroupResource.cs new file mode 100644 index 000000000000..b0cfc6f02f62 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherResourceGroupResource.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.DatabaseWatcher.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableDatabaseWatcherResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableDatabaseWatcherResourceGroupResource() + { + } + + /// 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 MockableDatabaseWatcherResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of DatabaseWatcherResources in the ResourceGroupResource. + /// An object representing collection of DatabaseWatcherResources and their operations over a DatabaseWatcherResource. + public virtual DatabaseWatcherCollection GetDatabaseWatchers() + { + return GetCachedClient(client => new DatabaseWatcherCollection(client, Id)); + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDatabaseWatcherAsync(string watcherName, CancellationToken cancellationToken = default) + { + return await GetDatabaseWatchers().GetAsync(watcherName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Watcher + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DatabaseWatcher/watchers/{watcherName} + /// + /// + /// Operation Id + /// Watcher_Get + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The database watcher name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDatabaseWatcher(string watcherName, CancellationToken cancellationToken = default) + { + return GetDatabaseWatchers().Get(watcherName, cancellationToken); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherSubscriptionResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherSubscriptionResource.cs new file mode 100644 index 000000000000..9b8b00ee8cc4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/MockableDatabaseWatcherSubscriptionResource.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.DatabaseWatcher.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableDatabaseWatcherSubscriptionResource : ArmResource + { + private ClientDiagnostics _databaseWatcherWatchersClientDiagnostics; + private WatchersRestOperations _databaseWatcherWatchersRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableDatabaseWatcherSubscriptionResource() + { + } + + /// 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 MockableDatabaseWatcherSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics DatabaseWatcherWatchersClientDiagnostics => _databaseWatcherWatchersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", DatabaseWatcherResource.ResourceType.Namespace, Diagnostics); + private WatchersRestOperations DatabaseWatcherWatchersRestClient => _databaseWatcherWatchersRestClient ??= new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DatabaseWatcherResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List Watcher resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDatabaseWatchersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatabaseWatcherWatchersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatabaseWatcherWatchersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherResource(Client, DatabaseWatcherData.DeserializeDatabaseWatcherData(e)), DatabaseWatcherWatchersClientDiagnostics, Pipeline, "MockableDatabaseWatcherSubscriptionResource.GetDatabaseWatchers", "value", "nextLink", cancellationToken); + } + + /// + /// List Watcher resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DatabaseWatcher/watchers + /// + /// + /// Operation Id + /// Watcher_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-01-02 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDatabaseWatchers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DatabaseWatcherWatchersRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DatabaseWatcherWatchersRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DatabaseWatcherResource(Client, DatabaseWatcherData.DeserializeDatabaseWatcherData(e)), DatabaseWatcherWatchersClientDiagnostics, Pipeline, "MockableDatabaseWatcherSubscriptionResource.GetDatabaseWatchers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Argument.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..32f9b26aaec4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..6afbde7e464c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingList.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..7d07be2128e8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..c66b779c62c5 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Optional.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..78fe76f53503 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..e46e08cbf3ee --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperation.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperation.cs new file mode 100644 index 000000000000..0380185acc37 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperation.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.DatabaseWatcher +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DatabaseWatcherArmOperation : 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 DatabaseWatcherArmOperation for mocking. + protected DatabaseWatcherArmOperation() + { + } + + internal DatabaseWatcherArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DatabaseWatcherArmOperation(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, "DatabaseWatcherArmOperation", 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperationOfT.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperationOfT.cs new file mode 100644 index 000000000000..7bc2029706fc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherArmOperationOfT.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.DatabaseWatcher +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DatabaseWatcherArmOperation : 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 DatabaseWatcherArmOperation for mocking. + protected DatabaseWatcherArmOperation() + { + } + + internal DatabaseWatcherArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DatabaseWatcherArmOperation(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, "DatabaseWatcherArmOperation", 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherHealthValidationOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherHealthValidationOperationSource.cs new file mode 100644 index 000000000000..11725287c78f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherHealthValidationOperationSource.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.DatabaseWatcher +{ + internal class DatabaseWatcherHealthValidationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseWatcherHealthValidationOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseWatcherHealthValidationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new DatabaseWatcherHealthValidationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new DatabaseWatcherHealthValidationResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherOperationSource.cs new file mode 100644 index 000000000000..232d00b8e03b --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherOperationSource.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.DatabaseWatcher +{ + internal class DatabaseWatcherOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseWatcherOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseWatcherResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new DatabaseWatcherResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new DatabaseWatcherResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherSharedPrivateLinkResourceOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherSharedPrivateLinkResourceOperationSource.cs new file mode 100644 index 000000000000..b9a133f398c7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/DatabaseWatcherSharedPrivateLinkResourceOperationSource.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.DatabaseWatcher +{ + internal class DatabaseWatcherSharedPrivateLinkResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DatabaseWatcherSharedPrivateLinkResourceOperationSource(ArmClient client) + { + _client = client; + } + + DatabaseWatcherSharedPrivateLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new DatabaseWatcherSharedPrivateLinkResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new DatabaseWatcherSharedPrivateLinkResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleCreationProperty.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleCreationProperty.cs new file mode 100644 index 000000000000..182479a7ce69 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleCreationProperty.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.DatabaseWatcher.Models +{ + /// The properties with which the alert rule resource was created. + public readonly partial struct AlertRuleCreationProperty : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AlertRuleCreationProperty(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreatedWithActionGroupValue = "CreatedWithActionGroup"; + private const string NoneValue = "None"; + + /// The alert rule was created with an action group. + public static AlertRuleCreationProperty CreatedWithActionGroup { get; } = new AlertRuleCreationProperty(CreatedWithActionGroupValue); + /// The alert rule was created with no properties. + public static AlertRuleCreationProperty None { get; } = new AlertRuleCreationProperty(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(AlertRuleCreationProperty left, AlertRuleCreationProperty right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AlertRuleCreationProperty left, AlertRuleCreationProperty right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AlertRuleCreationProperty(string value) => new AlertRuleCreationProperty(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AlertRuleCreationProperty other && Equals(other); + /// + public bool Equals(AlertRuleCreationProperty 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.Serialization.cs new file mode 100644 index 000000000000..0fab4444688d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.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.DatabaseWatcher.Models +{ + internal partial class AlertRuleResourceListResult : 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(AlertRuleResourceListResult)} 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 + } + } + } + + AlertRuleResourceListResult 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(AlertRuleResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAlertRuleResourceListResult(document.RootElement, options); + } + + internal static AlertRuleResourceListResult DeserializeAlertRuleResourceListResult(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(DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(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 AlertRuleResourceListResult(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(AlertRuleResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + AlertRuleResourceListResult 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 DeserializeAlertRuleResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AlertRuleResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.cs new file mode 100644 index 000000000000..758e9310b3d4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceListResult.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.DatabaseWatcher.Models +{ + /// The response of a AlertRuleResource list operation. + internal partial class AlertRuleResourceListResult + { + /// + /// 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 AlertRuleResource items on this page. + /// is null. + internal AlertRuleResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AlertRuleResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AlertRuleResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AlertRuleResourceListResult() + { + } + + /// The AlertRuleResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.Serialization.cs new file mode 100644 index 000000000000..0a0777bac5f8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.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.ResourceManager.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherAlertRuleProperties : 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(DatabaseWatcherAlertRuleProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("alertRuleResourceId"u8); + writer.WriteStringValue(AlertRuleResourceId); + writer.WritePropertyName("createdWithProperties"u8); + writer.WriteStringValue(CreatedWithProperties.ToString()); + writer.WritePropertyName("creationTime"u8); + writer.WriteStringValue(CreatedOn, "O"); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("alertRuleTemplateId"u8); + writer.WriteStringValue(AlertRuleTemplateId); + writer.WritePropertyName("alertRuleTemplateVersion"u8); + writer.WriteStringValue(AlertRuleTemplateVersion); + 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 + } + } + } + + DatabaseWatcherAlertRuleProperties 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(DatabaseWatcherAlertRuleProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherAlertRuleProperties(document.RootElement, options); + } + + internal static DatabaseWatcherAlertRuleProperties DeserializeDatabaseWatcherAlertRuleProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier alertRuleResourceId = default; + AlertRuleCreationProperty createdWithProperties = default; + DateTimeOffset creationTime = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + string alertRuleTemplateId = default; + string alertRuleTemplateVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alertRuleResourceId"u8)) + { + alertRuleResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdWithProperties"u8)) + { + createdWithProperties = new AlertRuleCreationProperty(property.Value.GetString()); + continue; + } + if (property.NameEquals("creationTime"u8)) + { + creationTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("alertRuleTemplateId"u8)) + { + alertRuleTemplateId = property.Value.GetString(); + continue; + } + if (property.NameEquals("alertRuleTemplateVersion"u8)) + { + alertRuleTemplateVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherAlertRuleProperties( + alertRuleResourceId, + createdWithProperties, + creationTime, + provisioningState, + alertRuleTemplateId, + alertRuleTemplateVersion, + 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(DatabaseWatcherAlertRuleProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherAlertRuleProperties 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 DeserializeDatabaseWatcherAlertRuleProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherAlertRuleProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.cs new file mode 100644 index 000000000000..d61c6e5df6b4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherAlertRuleProperties.cs @@ -0,0 +1,106 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The generic properties of the alert rule proxy resource. + public partial class DatabaseWatcherAlertRuleProperties + { + /// + /// 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 resource ID of the alert rule resource. + /// The properties with which the alert rule resource was created. + /// The creation time of the alert rule resource. + /// The template ID associated with alert rule resource. + /// The alert rule template version. + /// , or is null. + public DatabaseWatcherAlertRuleProperties(ResourceIdentifier alertRuleResourceId, AlertRuleCreationProperty createdWithProperties, DateTimeOffset createdOn, string alertRuleTemplateId, string alertRuleTemplateVersion) + { + Argument.AssertNotNull(alertRuleResourceId, nameof(alertRuleResourceId)); + Argument.AssertNotNull(alertRuleTemplateId, nameof(alertRuleTemplateId)); + Argument.AssertNotNull(alertRuleTemplateVersion, nameof(alertRuleTemplateVersion)); + + AlertRuleResourceId = alertRuleResourceId; + CreatedWithProperties = createdWithProperties; + CreatedOn = createdOn; + AlertRuleTemplateId = alertRuleTemplateId; + AlertRuleTemplateVersion = alertRuleTemplateVersion; + } + + /// Initializes a new instance of . + /// The resource ID of the alert rule resource. + /// The properties with which the alert rule resource was created. + /// The creation time of the alert rule resource. + /// The provisioning state of the alert rule resource. + /// The template ID associated with alert rule resource. + /// The alert rule template version. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherAlertRuleProperties(ResourceIdentifier alertRuleResourceId, AlertRuleCreationProperty createdWithProperties, DateTimeOffset createdOn, DatabaseWatcherResourceProvisioningState? provisioningState, string alertRuleTemplateId, string alertRuleTemplateVersion, IDictionary serializedAdditionalRawData) + { + AlertRuleResourceId = alertRuleResourceId; + CreatedWithProperties = createdWithProperties; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + AlertRuleTemplateId = alertRuleTemplateId; + AlertRuleTemplateVersion = alertRuleTemplateVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherAlertRuleProperties() + { + } + + /// The resource ID of the alert rule resource. + public ResourceIdentifier AlertRuleResourceId { get; set; } + /// The properties with which the alert rule resource was created. + public AlertRuleCreationProperty CreatedWithProperties { get; set; } + /// The creation time of the alert rule resource. + public DateTimeOffset CreatedOn { get; set; } + /// The provisioning state of the alert rule resource. + public DatabaseWatcherResourceProvisioningState? ProvisioningState { get; } + /// The template ID associated with alert rule resource. + public string AlertRuleTemplateId { get; set; } + /// The alert rule template version. + public string AlertRuleTemplateVersion { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.Serialization.cs new file mode 100644 index 000000000000..960022b737cb --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.Serialization.cs @@ -0,0 +1,192 @@ +// 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.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherDatastore : 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(DatabaseWatcherDatastore)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AdxClusterResourceId)) + { + writer.WritePropertyName("adxClusterResourceId"u8); + writer.WriteStringValue(AdxClusterResourceId); + } + if (Optional.IsDefined(KustoClusterDisplayName)) + { + writer.WritePropertyName("kustoClusterDisplayName"u8); + writer.WriteStringValue(KustoClusterDisplayName); + } + writer.WritePropertyName("kustoClusterUri"u8); + writer.WriteStringValue(KustoClusterUri.AbsoluteUri); + writer.WritePropertyName("kustoDataIngestionUri"u8); + writer.WriteStringValue(KustoDataIngestionUri.AbsoluteUri); + writer.WritePropertyName("kustoDatabaseName"u8); + writer.WriteStringValue(KustoDatabaseName); + writer.WritePropertyName("kustoManagementUrl"u8); + writer.WriteStringValue(KustoManagementUri.AbsoluteUri); + writer.WritePropertyName("kustoOfferingType"u8); + writer.WriteStringValue(KustoOfferingType.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 + } + } + } + + DatabaseWatcherDatastore 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(DatabaseWatcherDatastore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherDatastore(document.RootElement, options); + } + + internal static DatabaseWatcherDatastore DeserializeDatabaseWatcherDatastore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier adxClusterResourceId = default; + string kustoClusterDisplayName = default; + Uri kustoClusterUri = default; + Uri kustoDataIngestionUri = default; + string kustoDatabaseName = default; + Uri kustoManagementUrl = default; + KustoOfferingType kustoOfferingType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("adxClusterResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + adxClusterResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("kustoClusterDisplayName"u8)) + { + kustoClusterDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kustoClusterUri"u8)) + { + kustoClusterUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kustoDataIngestionUri"u8)) + { + kustoDataIngestionUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kustoDatabaseName"u8)) + { + kustoDatabaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kustoManagementUrl"u8)) + { + kustoManagementUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kustoOfferingType"u8)) + { + kustoOfferingType = new KustoOfferingType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherDatastore( + adxClusterResourceId, + kustoClusterDisplayName, + kustoClusterUri, + kustoDataIngestionUri, + kustoDatabaseName, + kustoManagementUrl, + kustoOfferingType, + 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(DatabaseWatcherDatastore)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherDatastore 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 DeserializeDatabaseWatcherDatastore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherDatastore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.cs new file mode 100644 index 000000000000..afe036ba8e70 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherDatastore.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The properties of a data store. + public partial class DatabaseWatcherDatastore + { + /// + /// 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 Kusto cluster URI. + /// The Kusto data ingestion URI. + /// The name of a Kusto database. + /// The Kusto management URL. + /// The type of a Kusto offering. + /// , , or is null. + public DatabaseWatcherDatastore(Uri kustoClusterUri, Uri kustoDataIngestionUri, string kustoDatabaseName, Uri kustoManagementUri, KustoOfferingType kustoOfferingType) + { + Argument.AssertNotNull(kustoClusterUri, nameof(kustoClusterUri)); + Argument.AssertNotNull(kustoDataIngestionUri, nameof(kustoDataIngestionUri)); + Argument.AssertNotNull(kustoDatabaseName, nameof(kustoDatabaseName)); + Argument.AssertNotNull(kustoManagementUri, nameof(kustoManagementUri)); + + KustoClusterUri = kustoClusterUri; + KustoDataIngestionUri = kustoDataIngestionUri; + KustoDatabaseName = kustoDatabaseName; + KustoManagementUri = kustoManagementUri; + KustoOfferingType = kustoOfferingType; + } + + /// Initializes a new instance of . + /// The Azure resource ID of an Azure Data Explorer cluster. + /// The Kusto cluster display name. + /// The Kusto cluster URI. + /// The Kusto data ingestion URI. + /// The name of a Kusto database. + /// The Kusto management URL. + /// The type of a Kusto offering. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherDatastore(ResourceIdentifier adxClusterResourceId, string kustoClusterDisplayName, Uri kustoClusterUri, Uri kustoDataIngestionUri, string kustoDatabaseName, Uri kustoManagementUri, KustoOfferingType kustoOfferingType, IDictionary serializedAdditionalRawData) + { + AdxClusterResourceId = adxClusterResourceId; + KustoClusterDisplayName = kustoClusterDisplayName; + KustoClusterUri = kustoClusterUri; + KustoDataIngestionUri = kustoDataIngestionUri; + KustoDatabaseName = kustoDatabaseName; + KustoManagementUri = kustoManagementUri; + KustoOfferingType = kustoOfferingType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherDatastore() + { + } + + /// The Azure resource ID of an Azure Data Explorer cluster. + public ResourceIdentifier AdxClusterResourceId { get; set; } + /// The Kusto cluster display name. + public string KustoClusterDisplayName { get; set; } + /// The Kusto cluster URI. + public Uri KustoClusterUri { get; set; } + /// The Kusto data ingestion URI. + public Uri KustoDataIngestionUri { get; set; } + /// The name of a Kusto database. + public string KustoDatabaseName { get; set; } + /// The Kusto management URL. + public Uri KustoManagementUri { get; set; } + /// The type of a Kusto offering. + public KustoOfferingType KustoOfferingType { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.Serialization.cs new file mode 100644 index 000000000000..84e4cbbb198a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.Serialization.cs @@ -0,0 +1,215 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherHealthValidationIssue : 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(DatabaseWatcherHealthValidationIssue)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("errorCode"u8); + writer.WriteStringValue(ErrorCode); + } + if (options.Format != "W") + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (options.Format != "W" && Optional.IsDefined(AdditionalDetails)) + { + writer.WritePropertyName("additionalDetails"u8); + writer.WriteStringValue(AdditionalDetails); + } + if (options.Format != "W") + { + writer.WritePropertyName("recommendationMessage"u8); + writer.WriteStringValue(RecommendationMessage); + } + if (options.Format != "W" && Optional.IsDefined(RecommendationUri)) + { + writer.WritePropertyName("recommendationUrl"u8); + writer.WriteStringValue(RecommendationUri.AbsoluteUri); + } + if (options.Format != "W" && Optional.IsDefined(RelatedResourceId)) + { + writer.WritePropertyName("relatedResourceId"u8); + writer.WriteStringValue(RelatedResourceId); + } + if (options.Format != "W" && Optional.IsDefined(RelatedResourceType)) + { + writer.WritePropertyName("relatedResourceType"u8); + writer.WriteStringValue(RelatedResourceType.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 + } + } + } + + DatabaseWatcherHealthValidationIssue 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(DatabaseWatcherHealthValidationIssue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherHealthValidationIssue(document.RootElement, options); + } + + internal static DatabaseWatcherHealthValidationIssue DeserializeDatabaseWatcherHealthValidationIssue(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string errorCode = default; + string errorMessage = default; + string additionalDetails = default; + string recommendationMessage = default; + Uri recommendationUrl = default; + ResourceIdentifier relatedResourceId = default; + ResourceType? relatedResourceType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errorCode"u8)) + { + errorCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("errorMessage"u8)) + { + errorMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalDetails"u8)) + { + additionalDetails = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendationMessage"u8)) + { + recommendationMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("recommendationUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recommendationUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("relatedResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relatedResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("relatedResourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + relatedResourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherHealthValidationIssue( + errorCode, + errorMessage, + additionalDetails, + recommendationMessage, + recommendationUrl, + relatedResourceId, + relatedResourceType, + 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(DatabaseWatcherHealthValidationIssue)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherHealthValidationIssue 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 DeserializeDatabaseWatcherHealthValidationIssue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherHealthValidationIssue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.cs new file mode 100644 index 000000000000..6dcf8e8a9468 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationIssue.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The model of a health validation issue. + public partial class DatabaseWatcherHealthValidationIssue + { + /// + /// 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 of the issue. + /// The error message of the issue. + /// The recommendation for resolving the issue. + internal DatabaseWatcherHealthValidationIssue(string errorCode, string errorMessage, string recommendationMessage) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + RecommendationMessage = recommendationMessage; + } + + /// Initializes a new instance of . + /// The error code of the issue. + /// The error message of the issue. + /// The additional details for the issue. + /// The recommendation for resolving the issue. + /// The URL related to resolving the issue. + /// The resource ID of the Azure resource related to the issue. + /// The type of the Azure resource related to the issue. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherHealthValidationIssue(string errorCode, string errorMessage, string additionalDetails, string recommendationMessage, Uri recommendationUri, ResourceIdentifier relatedResourceId, ResourceType? relatedResourceType, IDictionary serializedAdditionalRawData) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + AdditionalDetails = additionalDetails; + RecommendationMessage = recommendationMessage; + RecommendationUri = recommendationUri; + RelatedResourceId = relatedResourceId; + RelatedResourceType = relatedResourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherHealthValidationIssue() + { + } + + /// The error code of the issue. + public string ErrorCode { get; } + /// The error message of the issue. + public string ErrorMessage { get; } + /// The additional details for the issue. + public string AdditionalDetails { get; } + /// The recommendation for resolving the issue. + public string RecommendationMessage { get; } + /// The URL related to resolving the issue. + public Uri RecommendationUri { get; } + /// The resource ID of the Azure resource related to the issue. + public ResourceIdentifier RelatedResourceId { get; } + /// The type of the Azure resource related to the issue. + public ResourceType? RelatedResourceType { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.Serialization.cs new file mode 100644 index 000000000000..fdf20cd924cf --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.Serialization.cs @@ -0,0 +1,193 @@ +// 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.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherHealthValidationProperties : 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(DatabaseWatcherHealthValidationProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("issues"u8); + writer.WriteStartArray(); + foreach (var item in Issues) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + 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 + } + } + } + + DatabaseWatcherHealthValidationProperties 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(DatabaseWatcherHealthValidationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherHealthValidationProperties(document.RootElement, options); + } + + internal static DatabaseWatcherHealthValidationProperties DeserializeDatabaseWatcherHealthValidationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset startTime = default; + DateTimeOffset endTime = default; + DatabaseWatcherHealthValidationStatus status = default; + IReadOnlyList issues = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime"u8)) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new DatabaseWatcherHealthValidationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("issues"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseWatcherHealthValidationIssue.DeserializeDatabaseWatcherHealthValidationIssue(item, options)); + } + issues = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherHealthValidationProperties( + startTime, + endTime, + status, + issues, + 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(DatabaseWatcherHealthValidationProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherHealthValidationProperties 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 DeserializeDatabaseWatcherHealthValidationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherHealthValidationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.cs new file mode 100644 index 000000000000..bb3744dd7147 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationProperties.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The generic properties of the health validation resource. + public partial class DatabaseWatcherHealthValidationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The start time of health validation, in UTC. + /// The end time of health validation, in UTC. + /// The current health validation status. + /// The list of issues found by health validation. + internal DatabaseWatcherHealthValidationProperties(DateTimeOffset startOn, DateTimeOffset endOn, DatabaseWatcherHealthValidationStatus status, IEnumerable issues) + { + StartOn = startOn; + EndOn = endOn; + Status = status; + Issues = issues.ToList(); + } + + /// Initializes a new instance of . + /// The start time of health validation, in UTC. + /// The end time of health validation, in UTC. + /// The current health validation status. + /// The list of issues found by health validation. + /// The provisioning state of the health validation resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherHealthValidationProperties(DateTimeOffset startOn, DateTimeOffset endOn, DatabaseWatcherHealthValidationStatus status, IReadOnlyList issues, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + Status = status; + Issues = issues; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherHealthValidationProperties() + { + } + + /// The start time of health validation, in UTC. + public DateTimeOffset StartOn { get; } + /// The end time of health validation, in UTC. + public DateTimeOffset EndOn { get; } + /// The current health validation status. + public DatabaseWatcherHealthValidationStatus Status { get; } + /// The list of issues found by health validation. + public IReadOnlyList Issues { get; } + /// The provisioning state of the health validation resource. + public DatabaseWatcherResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationStatus.cs new file mode 100644 index 000000000000..293207dda48b --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherHealthValidationStatus.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// Health validation status. + public readonly partial struct DatabaseWatcherHealthValidationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseWatcherHealthValidationStatus(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"; + private const string TimedOutValue = "TimedOut"; + + /// Health validation has not started. + public static DatabaseWatcherHealthValidationStatus NotStarted { get; } = new DatabaseWatcherHealthValidationStatus(NotStartedValue); + /// Health validation is running. + public static DatabaseWatcherHealthValidationStatus Running { get; } = new DatabaseWatcherHealthValidationStatus(RunningValue); + /// Health validation completed successfully. + public static DatabaseWatcherHealthValidationStatus Succeeded { get; } = new DatabaseWatcherHealthValidationStatus(SucceededValue); + /// Health validation failed. + public static DatabaseWatcherHealthValidationStatus Failed { get; } = new DatabaseWatcherHealthValidationStatus(FailedValue); + /// Health validation was canceled. + public static DatabaseWatcherHealthValidationStatus Canceled { get; } = new DatabaseWatcherHealthValidationStatus(CanceledValue); + /// Health validation timed out. + public static DatabaseWatcherHealthValidationStatus TimedOut { get; } = new DatabaseWatcherHealthValidationStatus(TimedOutValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseWatcherHealthValidationStatus left, DatabaseWatcherHealthValidationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseWatcherHealthValidationStatus left, DatabaseWatcherHealthValidationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatabaseWatcherHealthValidationStatus(string value) => new DatabaseWatcherHealthValidationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseWatcherHealthValidationStatus other && Equals(other); + /// + public bool Equals(DatabaseWatcherHealthValidationStatus 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.Serialization.cs new file mode 100644 index 000000000000..44cb69f170d2 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.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.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherPatch : 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(DatabaseWatcherPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + DatabaseWatcherPatch 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(DatabaseWatcherPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherPatch(document.RootElement, options); + } + + internal static DatabaseWatcherPatch DeserializeDatabaseWatcherPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentityV4 identity = default; + IDictionary tags = default; + WatcherUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = ManagedServiceIdentityV4.DeserializeManagedServiceIdentityV4(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("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WatcherUpdateProperties.DeserializeWatcherUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherPatch(identity, tags ?? new ChangeTrackingDictionary(), 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(DatabaseWatcherPatch)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherPatch 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 DeserializeDatabaseWatcherPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.cs new file mode 100644 index 000000000000..f1285b154346 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherPatch.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The type used for update operations of the Watcher. + public partial class DatabaseWatcherPatch + { + /// + /// 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 DatabaseWatcherPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherPatch(ManagedServiceIdentityV4 identity, IDictionary tags, WatcherUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentityV4 Identity { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public WatcherUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.Serialization.cs new file mode 100644 index 000000000000..85145a36327e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.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; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherProperties : 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(DatabaseWatcherProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Datastore)) + { + writer.WritePropertyName("datastore"u8); + writer.WriteObjectValue(Datastore, options); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(DefaultAlertRuleIdentityResourceId)) + { + writer.WritePropertyName("defaultAlertRuleIdentityResourceId"u8); + writer.WriteStringValue(DefaultAlertRuleIdentityResourceId); + } + 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 + } + } + } + + DatabaseWatcherProperties 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(DatabaseWatcherProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherProperties(document.RootElement, options); + } + + internal static DatabaseWatcherProperties DeserializeDatabaseWatcherProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherDatastore datastore = default; + DatabaseWatcherStatus? status = default; + DatabaseWatcherProvisioningState? provisioningState = default; + ResourceIdentifier defaultAlertRuleIdentityResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("datastore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + datastore = DatabaseWatcherDatastore.DeserializeDatabaseWatcherDatastore(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DatabaseWatcherStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("defaultAlertRuleIdentityResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultAlertRuleIdentityResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherProperties(datastore, status, provisioningState, defaultAlertRuleIdentityResourceId, 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(DatabaseWatcherProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherProperties 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 DeserializeDatabaseWatcherProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.cs new file mode 100644 index 000000000000..ea57e69ab537 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProperties.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The RP specific properties of the resource. + public partial class DatabaseWatcherProperties + { + /// + /// 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 DatabaseWatcherProperties() + { + } + + /// Initializes a new instance of . + /// The data store for collected monitoring data. + /// The monitoring collection status of the watcher. + /// The provisioning state of the resource watcher. + /// The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherProperties(DatabaseWatcherDatastore datastore, DatabaseWatcherStatus? status, DatabaseWatcherProvisioningState? provisioningState, ResourceIdentifier defaultAlertRuleIdentityResourceId, IDictionary serializedAdditionalRawData) + { + Datastore = datastore; + Status = status; + ProvisioningState = provisioningState; + DefaultAlertRuleIdentityResourceId = defaultAlertRuleIdentityResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The data store for collected monitoring data. + public DatabaseWatcherDatastore Datastore { get; set; } + /// The monitoring collection status of the watcher. + public DatabaseWatcherStatus? Status { get; } + /// The provisioning state of the resource watcher. + public DatabaseWatcherProvisioningState? ProvisioningState { get; } + /// The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + public ResourceIdentifier DefaultAlertRuleIdentityResourceId { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProvisioningState.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProvisioningState.cs new file mode 100644 index 000000000000..1d26cbf74b16 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherProvisioningState.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.DatabaseWatcher.Models +{ + /// The status of the last provisioning operation performed on the resource. + public readonly partial struct DatabaseWatcherProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseWatcherProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static DatabaseWatcherProvisioningState Succeeded { get; } = new DatabaseWatcherProvisioningState(SucceededValue); + /// Resource creation failed. + public static DatabaseWatcherProvisioningState Failed { get; } = new DatabaseWatcherProvisioningState(FailedValue); + /// Resource creation was canceled. + public static DatabaseWatcherProvisioningState Canceled { get; } = new DatabaseWatcherProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseWatcherProvisioningState left, DatabaseWatcherProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseWatcherProvisioningState left, DatabaseWatcherProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatabaseWatcherProvisioningState(string value) => new DatabaseWatcherProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseWatcherProvisioningState other && Equals(other); + /// + public bool Equals(DatabaseWatcherProvisioningState 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherResourceProvisioningState.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherResourceProvisioningState.cs new file mode 100644 index 000000000000..d9eb506a2833 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherResourceProvisioningState.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.DatabaseWatcher.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct DatabaseWatcherResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseWatcherResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static DatabaseWatcherResourceProvisioningState Succeeded { get; } = new DatabaseWatcherResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static DatabaseWatcherResourceProvisioningState Failed { get; } = new DatabaseWatcherResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static DatabaseWatcherResourceProvisioningState Canceled { get; } = new DatabaseWatcherResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseWatcherResourceProvisioningState left, DatabaseWatcherResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseWatcherResourceProvisioningState left, DatabaseWatcherResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatabaseWatcherResourceProvisioningState(string value) => new DatabaseWatcherResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseWatcherResourceProvisioningState other && Equals(other); + /// + public bool Equals(DatabaseWatcherResourceProvisioningState 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..f6c1eb78d5a4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.Serialization.cs @@ -0,0 +1,190 @@ +// 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.DatabaseWatcher.Models +{ + public partial class DatabaseWatcherSharedPrivateLinkResourceProperties : 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(DatabaseWatcherSharedPrivateLinkResourceProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("privateLinkResourceId"u8); + writer.WriteStringValue(PrivateLinkResourceId); + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + writer.WritePropertyName("requestMessage"u8); + writer.WriteStringValue(RequestMessage); + if (Optional.IsDefined(DnsZone)) + { + writer.WritePropertyName("dnsZone"u8); + writer.WriteStringValue(DnsZone); + } + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + 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 + } + } + } + + DatabaseWatcherSharedPrivateLinkResourceProperties 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(DatabaseWatcherSharedPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherSharedPrivateLinkResourceProperties(document.RootElement, options); + } + + internal static DatabaseWatcherSharedPrivateLinkResourceProperties DeserializeDatabaseWatcherSharedPrivateLinkResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier privateLinkResourceId = default; + string groupId = default; + string requestMessage = default; + string dnsZone = default; + DatabaseWatcherSharedPrivateLinkResourceStatus? status = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("privateLinkResourceId"u8)) + { + privateLinkResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("requestMessage"u8)) + { + requestMessage = property.Value.GetString(); + continue; + } + if (property.NameEquals("dnsZone"u8)) + { + dnsZone = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DatabaseWatcherSharedPrivateLinkResourceStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseWatcherSharedPrivateLinkResourceProperties( + privateLinkResourceId, + groupId, + requestMessage, + dnsZone, + status, + 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(DatabaseWatcherSharedPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherSharedPrivateLinkResourceProperties 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 DeserializeDatabaseWatcherSharedPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherSharedPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..bacf7a0f69a5 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceProperties.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The generic properties of a Shared Private Link resource. + public partial class DatabaseWatcherSharedPrivateLinkResourceProperties + { + /// + /// 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 resource ID of the resource the shared private link resource is for. + /// The group id from the provider of resource the shared private link resource is for. + /// The request message for requesting approval of the shared private link resource. + /// , or is null. + public DatabaseWatcherSharedPrivateLinkResourceProperties(ResourceIdentifier privateLinkResourceId, string groupId, string requestMessage) + { + Argument.AssertNotNull(privateLinkResourceId, nameof(privateLinkResourceId)); + Argument.AssertNotNull(groupId, nameof(groupId)); + Argument.AssertNotNull(requestMessage, nameof(requestMessage)); + + PrivateLinkResourceId = privateLinkResourceId; + GroupId = groupId; + RequestMessage = requestMessage; + } + + /// Initializes a new instance of . + /// The resource ID of the resource the shared private link resource is for. + /// The group id from the provider of resource the shared private link resource is for. + /// The request message for requesting approval of the shared private link resource. + /// The DNS zone segment to be included in the DNS name of the shared private link. Value is required for Azure Data Explorer clusters and SQL managed instances, and must be omitted for SQL logical servers and key vaults. The value is the second segment of the host FQDN name of the resource that the shared private link resource is for. For example: if the host name is 'adx-cluster-21187695.eastus.kusto.windows.net', then the value is 'eastus'; if the host name is 'sql-mi-23961134.767d5869f605.database.windows.net', then the value is '767d5869f605'. + /// Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherSharedPrivateLinkResourceProperties(ResourceIdentifier privateLinkResourceId, string groupId, string requestMessage, string dnsZone, DatabaseWatcherSharedPrivateLinkResourceStatus? status, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + PrivateLinkResourceId = privateLinkResourceId; + GroupId = groupId; + RequestMessage = requestMessage; + DnsZone = dnsZone; + Status = status; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherSharedPrivateLinkResourceProperties() + { + } + + /// The resource ID of the resource the shared private link resource is for. + public ResourceIdentifier PrivateLinkResourceId { get; set; } + /// The group id from the provider of resource the shared private link resource is for. + public string GroupId { get; set; } + /// The request message for requesting approval of the shared private link resource. + public string RequestMessage { get; set; } + /// The DNS zone segment to be included in the DNS name of the shared private link. Value is required for Azure Data Explorer clusters and SQL managed instances, and must be omitted for SQL logical servers and key vaults. The value is the second segment of the host FQDN name of the resource that the shared private link resource is for. For example: if the host name is 'adx-cluster-21187695.eastus.kusto.windows.net', then the value is 'eastus'; if the host name is 'sql-mi-23961134.767d5869f605.database.windows.net', then the value is '767d5869f605'. + public string DnsZone { get; set; } + /// Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + public DatabaseWatcherSharedPrivateLinkResourceStatus? Status { get; } + /// The provisioning state of the resource. + public DatabaseWatcherResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceStatus.cs new file mode 100644 index 000000000000..332cbf5adf5d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherSharedPrivateLinkResourceStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// Status of the shared private link resource. Can be Pending, Approved, Rejected or Disconnected. + public readonly partial struct DatabaseWatcherSharedPrivateLinkResourceStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseWatcherSharedPrivateLinkResourceStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + private const string DisconnectedValue = "Disconnected"; + + /// The shared private link connection request was not yet authorized by the resource owner. + public static DatabaseWatcherSharedPrivateLinkResourceStatus Pending { get; } = new DatabaseWatcherSharedPrivateLinkResourceStatus(PendingValue); + /// The shared private link connection request was approved by the resource owner. + public static DatabaseWatcherSharedPrivateLinkResourceStatus Approved { get; } = new DatabaseWatcherSharedPrivateLinkResourceStatus(ApprovedValue); + /// The shared private link connection request was rejected by the resource owner. + public static DatabaseWatcherSharedPrivateLinkResourceStatus Rejected { get; } = new DatabaseWatcherSharedPrivateLinkResourceStatus(RejectedValue); + /// The shared private link connection request was disconnected by the resource owner. + public static DatabaseWatcherSharedPrivateLinkResourceStatus Disconnected { get; } = new DatabaseWatcherSharedPrivateLinkResourceStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseWatcherSharedPrivateLinkResourceStatus left, DatabaseWatcherSharedPrivateLinkResourceStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseWatcherSharedPrivateLinkResourceStatus left, DatabaseWatcherSharedPrivateLinkResourceStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatabaseWatcherSharedPrivateLinkResourceStatus(string value) => new DatabaseWatcherSharedPrivateLinkResourceStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseWatcherSharedPrivateLinkResourceStatus other && Equals(other); + /// + public bool Equals(DatabaseWatcherSharedPrivateLinkResourceStatus 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherStatus.cs new file mode 100644 index 000000000000..778cf0daceb8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherStatus.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.ResourceManager.DatabaseWatcher.Models +{ + /// The monitoring collection status of a watcher. + public readonly partial struct DatabaseWatcherStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DatabaseWatcherStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StartingValue = "Starting"; + private const string RunningValue = "Running"; + private const string StoppingValue = "Stopping"; + private const string StoppedValue = "Stopped"; + private const string DeletingValue = "Deleting"; + + /// Denotes the watcher is in a starting state. + public static DatabaseWatcherStatus Starting { get; } = new DatabaseWatcherStatus(StartingValue); + /// Denotes the watcher is in a running state. + public static DatabaseWatcherStatus Running { get; } = new DatabaseWatcherStatus(RunningValue); + /// Denotes the watcher is in a stopping state. + public static DatabaseWatcherStatus Stopping { get; } = new DatabaseWatcherStatus(StoppingValue); + /// Denotes the watcher is in a stopped state. + public static DatabaseWatcherStatus Stopped { get; } = new DatabaseWatcherStatus(StoppedValue); + /// Denotes the watcher is in a deleting state. + public static DatabaseWatcherStatus Deleting { get; } = new DatabaseWatcherStatus(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(DatabaseWatcherStatus left, DatabaseWatcherStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DatabaseWatcherStatus left, DatabaseWatcherStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DatabaseWatcherStatus(string value) => new DatabaseWatcherStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DatabaseWatcherStatus other && Equals(other); + /// + public bool Equals(DatabaseWatcherStatus 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.Serialization.cs new file mode 100644 index 000000000000..04393f4ebb47 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + [PersistableModelProxy(typeof(UnknownDatabaseWatcherTargetProperties))] + public partial class DatabaseWatcherTargetProperties : 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(DatabaseWatcherTargetProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("targetType"u8); + writer.WriteStringValue(TargetType); + writer.WritePropertyName("targetAuthenticationType"u8); + writer.WriteStringValue(TargetAuthenticationType.ToString()); + if (Optional.IsDefined(TargetVault)) + { + writer.WritePropertyName("targetVault"u8); + writer.WriteObjectValue(TargetVault, options); + } + writer.WritePropertyName("connectionServerName"u8); + writer.WriteStringValue(ConnectionServerName); + 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 + } + } + } + + DatabaseWatcherTargetProperties 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(DatabaseWatcherTargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherTargetProperties(document.RootElement, options); + } + + internal static DatabaseWatcherTargetProperties DeserializeDatabaseWatcherTargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("targetType", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "SqlDb": return SqlDBSingleDatabaseTargetProperties.DeserializeSqlDBSingleDatabaseTargetProperties(element, options); + case "SqlEp": return SqlDBElasticPoolTargetProperties.DeserializeSqlDBElasticPoolTargetProperties(element, options); + case "SqlMi": return SqlMITargetProperties.DeserializeSqlMITargetProperties(element, options); + } + } + return UnknownDatabaseWatcherTargetProperties.DeserializeUnknownDatabaseWatcherTargetProperties(element, options); + } + + 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(DatabaseWatcherTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherTargetProperties 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 DeserializeDatabaseWatcherTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.cs new file mode 100644 index 000000000000..e6142849b1c4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/DatabaseWatcherTargetProperties.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; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// + /// The generic properties of a target. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class DatabaseWatcherTargetProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// is null. + protected DatabaseWatcherTargetProperties(TargetAuthenticationType targetAuthenticationType, string connectionServerName) + { + Argument.AssertNotNull(connectionServerName, nameof(connectionServerName)); + + TargetAuthenticationType = targetAuthenticationType; + ConnectionServerName = connectionServerName; + } + + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseWatcherTargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, TargetAuthenticationVaultSecret targetVault, string connectionServerName, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + TargetType = targetType; + TargetAuthenticationType = targetAuthenticationType; + TargetVault = targetVault; + ConnectionServerName = connectionServerName; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseWatcherTargetProperties() + { + } + + /// Discriminator property for DatabaseWatcherTargetProperties. + internal string TargetType { get; set; } + /// The type of authentication to use when connecting to a target. + public TargetAuthenticationType TargetAuthenticationType { get; set; } + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + public TargetAuthenticationVaultSecret TargetVault { get; set; } + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + public string ConnectionServerName { get; set; } + /// The provisioning state of the resource. + public DatabaseWatcherResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.Serialization.cs new file mode 100644 index 000000000000..4e25354c4895 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.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.DatabaseWatcher.Models +{ + internal partial class HealthValidationListResult : 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(HealthValidationListResult)} 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 + } + } + } + + HealthValidationListResult 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(HealthValidationListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthValidationListResult(document.RootElement, options); + } + + internal static HealthValidationListResult DeserializeHealthValidationListResult(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(DatabaseWatcherHealthValidationData.DeserializeDatabaseWatcherHealthValidationData(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 HealthValidationListResult(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(HealthValidationListResult)} does not support writing '{options.Format}' format."); + } + } + + HealthValidationListResult 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 DeserializeHealthValidationListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthValidationListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.cs new file mode 100644 index 000000000000..e5a86a08b5b6 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.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.DatabaseWatcher.Models +{ + /// The response of a HealthValidation list operation. + internal partial class HealthValidationListResult + { + /// + /// 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 HealthValidation items on this page. + /// is null. + internal HealthValidationListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The HealthValidation items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal HealthValidationListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthValidationListResult() + { + } + + /// The HealthValidation items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/KustoOfferingType.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/KustoOfferingType.cs new file mode 100644 index 000000000000..5650f0cb4d19 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/KustoOfferingType.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.DatabaseWatcher.Models +{ + /// The type of Kusto offering. + public readonly partial struct KustoOfferingType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KustoOfferingType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AdxValue = "adx"; + private const string FreeValue = "free"; + private const string FabricValue = "fabric"; + + /// The Azure Data Explorer cluster Kusto offering. + public static KustoOfferingType Adx { get; } = new KustoOfferingType(AdxValue); + /// The free Azure Data Explorer cluster Kusto offering. + public static KustoOfferingType Free { get; } = new KustoOfferingType(FreeValue); + /// The Fabric Real-Time Analytics Kusto offering. + public static KustoOfferingType Fabric { get; } = new KustoOfferingType(FabricValue); + /// Determines if two values are the same. + public static bool operator ==(KustoOfferingType left, KustoOfferingType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KustoOfferingType left, KustoOfferingType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KustoOfferingType(string value) => new KustoOfferingType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KustoOfferingType other && Equals(other); + /// + public bool Equals(KustoOfferingType 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityType.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityType.cs new file mode 100644 index 000000000000..bf830748c396 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityType.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// Type of managed service identity (where both SystemAssigned and UserAssigned types are allowed). + public readonly partial struct ManagedServiceIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedServiceIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string SystemAssignedValue = "SystemAssigned"; + private const string UserAssignedValue = "UserAssigned"; + private const string SystemAndUserAssignedValue = "SystemAssigned, UserAssigned"; + + /// No managed identity. + public static ManagedServiceIdentityType None { get; } = new ManagedServiceIdentityType(NoneValue); + /// System assigned managed identity. + public static ManagedServiceIdentityType SystemAssigned { get; } = new ManagedServiceIdentityType(SystemAssignedValue); + /// User assigned managed identity. + public static ManagedServiceIdentityType UserAssigned { get; } = new ManagedServiceIdentityType(UserAssignedValue); + /// System and user assigned managed identity. + public static ManagedServiceIdentityType SystemAndUserAssigned { get; } = new ManagedServiceIdentityType(SystemAndUserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedServiceIdentityType left, ManagedServiceIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ManagedServiceIdentityType(string value) => new ManagedServiceIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedServiceIdentityType other && Equals(other); + /// + public bool Equals(ManagedServiceIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.Serialization.cs new file mode 100644 index 000000000000..1d9b55caf536 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.Serialization.cs @@ -0,0 +1,183 @@ +// 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.Models; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + public partial class ManagedServiceIdentityV4 : 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(ManagedServiceIdentityV4)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (options.Format != "W" && Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId.Value); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"u8); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + 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 + } + } + } + + ManagedServiceIdentityV4 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(ManagedServiceIdentityV4)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedServiceIdentityV4(document.RootElement, options); + } + + internal static ManagedServiceIdentityV4 DeserializeManagedServiceIdentityV4(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Guid? principalId = default; + Guid? tenantId = default; + ManagedServiceIdentityType type = default; + IDictionary userAssignedIdentities = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tenantId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ManagedServiceIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("userAssignedIdentities"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, JsonSerializer.Deserialize(property0.Value.GetRawText())); + } + userAssignedIdentities = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedServiceIdentityV4(principalId, tenantId, type, userAssignedIdentities ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ManagedServiceIdentityV4)} does not support writing '{options.Format}' format."); + } + } + + ManagedServiceIdentityV4 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 DeserializeManagedServiceIdentityV4(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedServiceIdentityV4)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.cs new file mode 100644 index 000000000000..284c3a903ae7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ManagedServiceIdentityV4.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// Managed service identity (system assigned and/or user assigned identities). + public partial class ManagedServiceIdentityV4 + { + /// + /// 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 type of managed identity assigned to this resource. + public ManagedServiceIdentityV4(ManagedServiceIdentityType type) + { + Type = type; + UserAssignedIdentities = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + /// The type of managed identity assigned to this resource. + /// The identities assigned to this resource by the user. + /// Keeps track of any properties unknown to the library. + internal ManagedServiceIdentityV4(Guid? principalId, Guid? tenantId, ManagedServiceIdentityType type, IDictionary userAssignedIdentities, IDictionary serializedAdditionalRawData) + { + PrincipalId = principalId; + TenantId = tenantId; + Type = type; + UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedServiceIdentityV4() + { + } + + /// The service principal ID of the system assigned identity. This property will only be provided for a system assigned identity. + public Guid? PrincipalId { get; } + /// The tenant ID of the system assigned identity. This property will only be provided for a system assigned identity. + public Guid? TenantId { get; } + /// The type of managed identity assigned to this resource. + public ManagedServiceIdentityType Type { get; set; } + /// The identities assigned to this resource by the user. + public IDictionary UserAssignedIdentities { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.Serialization.cs new file mode 100644 index 000000000000..de4100635495 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.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.DatabaseWatcher.Models +{ + internal partial class SharedPrivateLinkResourceListResult : 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(SharedPrivateLinkResourceListResult)} 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 + } + } + } + + SharedPrivateLinkResourceListResult 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(SharedPrivateLinkResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSharedPrivateLinkResourceListResult(document.RootElement, options); + } + + internal static SharedPrivateLinkResourceListResult DeserializeSharedPrivateLinkResourceListResult(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(DatabaseWatcherSharedPrivateLinkResourceData.DeserializeDatabaseWatcherSharedPrivateLinkResourceData(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 SharedPrivateLinkResourceListResult(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(SharedPrivateLinkResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + SharedPrivateLinkResourceListResult 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 DeserializeSharedPrivateLinkResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SharedPrivateLinkResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..ca549a0ef99f --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.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.DatabaseWatcher.Models +{ + /// The response of a SharedPrivateLinkResource list operation. + internal partial class SharedPrivateLinkResourceListResult + { + /// + /// 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 SharedPrivateLinkResource items on this page. + /// is null. + internal SharedPrivateLinkResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SharedPrivateLinkResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SharedPrivateLinkResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SharedPrivateLinkResourceListResult() + { + } + + /// The SharedPrivateLinkResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.Serialization.cs new file mode 100644 index 000000000000..fb496e85ca8c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.Serialization.cs @@ -0,0 +1,182 @@ +// 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.DatabaseWatcher.Models +{ + public partial class SqlDBElasticPoolTargetProperties : 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(SqlDBElasticPoolTargetProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("sqlEpResourceId"u8); + writer.WriteStringValue(SqlEpResourceId); + writer.WritePropertyName("anchorDatabaseResourceId"u8); + writer.WriteStringValue(AnchorDatabaseResourceId); + if (Optional.IsDefined(ReadIntent)) + { + writer.WritePropertyName("readIntent"u8); + writer.WriteBooleanValue(ReadIntent.Value); + } + } + + SqlDBElasticPoolTargetProperties 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(SqlDBElasticPoolTargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSqlDBElasticPoolTargetProperties(document.RootElement, options); + } + + internal static SqlDBElasticPoolTargetProperties DeserializeSqlDBElasticPoolTargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier sqlEpResourceId = default; + ResourceIdentifier anchorDatabaseResourceId = default; + bool? readIntent = default; + string targetType = default; + TargetAuthenticationType targetAuthenticationType = default; + TargetAuthenticationVaultSecret targetVault = default; + string connectionServerName = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sqlEpResourceId"u8)) + { + sqlEpResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("anchorDatabaseResourceId"u8)) + { + anchorDatabaseResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("readIntent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readIntent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("targetType"u8)) + { + targetType = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetAuthenticationType"u8)) + { + targetAuthenticationType = new TargetAuthenticationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetVault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetVault = TargetAuthenticationVaultSecret.DeserializeTargetAuthenticationVaultSecret(property.Value, options); + continue; + } + if (property.NameEquals("connectionServerName"u8)) + { + connectionServerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SqlDBElasticPoolTargetProperties( + targetType, + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData, + sqlEpResourceId, + anchorDatabaseResourceId, + readIntent); + } + + 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(SqlDBElasticPoolTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + SqlDBElasticPoolTargetProperties 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 DeserializeSqlDBElasticPoolTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SqlDBElasticPoolTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.cs new file mode 100644 index 000000000000..d1c918965a3a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBElasticPoolTargetProperties.cs @@ -0,0 +1,64 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The properties specific to an elastic pool in Azure SQL Database. + public partial class SqlDBElasticPoolTargetProperties : DatabaseWatcherTargetProperties + { + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The Azure resource ID of an Azure SQL DB elastic pool target. + /// The Azure resource ID of the anchor database used to connect to an elastic pool. + /// , or is null. + public SqlDBElasticPoolTargetProperties(TargetAuthenticationType targetAuthenticationType, string connectionServerName, ResourceIdentifier sqlEpResourceId, ResourceIdentifier anchorDatabaseResourceId) : base(targetAuthenticationType, connectionServerName) + { + Argument.AssertNotNull(connectionServerName, nameof(connectionServerName)); + Argument.AssertNotNull(sqlEpResourceId, nameof(sqlEpResourceId)); + Argument.AssertNotNull(anchorDatabaseResourceId, nameof(anchorDatabaseResourceId)); + + SqlEpResourceId = sqlEpResourceId; + AnchorDatabaseResourceId = anchorDatabaseResourceId; + TargetType = "SqlEp"; + } + + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + /// The Azure resource ID of an Azure SQL DB elastic pool target. + /// The Azure resource ID of the anchor database used to connect to an elastic pool. + /// Set to true to monitor a high availability replica of specified target, if any. + internal SqlDBElasticPoolTargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, TargetAuthenticationVaultSecret targetVault, string connectionServerName, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, ResourceIdentifier sqlEpResourceId, ResourceIdentifier anchorDatabaseResourceId, bool? readIntent) : base(targetType, targetAuthenticationType, targetVault, connectionServerName, provisioningState, serializedAdditionalRawData) + { + SqlEpResourceId = sqlEpResourceId; + AnchorDatabaseResourceId = anchorDatabaseResourceId; + ReadIntent = readIntent; + TargetType = targetType ?? "SqlEp"; + } + + /// Initializes a new instance of for deserialization. + internal SqlDBElasticPoolTargetProperties() + { + } + + /// The Azure resource ID of an Azure SQL DB elastic pool target. + public ResourceIdentifier SqlEpResourceId { get; set; } + /// The Azure resource ID of the anchor database used to connect to an elastic pool. + public ResourceIdentifier AnchorDatabaseResourceId { get; set; } + /// Set to true to monitor a high availability replica of specified target, if any. + public bool? ReadIntent { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.Serialization.cs new file mode 100644 index 000000000000..6617c7fe1330 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.Serialization.cs @@ -0,0 +1,173 @@ +// 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.DatabaseWatcher.Models +{ + public partial class SqlDBSingleDatabaseTargetProperties : 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(SqlDBSingleDatabaseTargetProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("sqlDbResourceId"u8); + writer.WriteStringValue(SqlDbResourceId); + if (Optional.IsDefined(ReadIntent)) + { + writer.WritePropertyName("readIntent"u8); + writer.WriteBooleanValue(ReadIntent.Value); + } + } + + SqlDBSingleDatabaseTargetProperties 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(SqlDBSingleDatabaseTargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSqlDBSingleDatabaseTargetProperties(document.RootElement, options); + } + + internal static SqlDBSingleDatabaseTargetProperties DeserializeSqlDBSingleDatabaseTargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier sqlDbResourceId = default; + bool? readIntent = default; + string targetType = default; + TargetAuthenticationType targetAuthenticationType = default; + TargetAuthenticationVaultSecret targetVault = default; + string connectionServerName = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sqlDbResourceId"u8)) + { + sqlDbResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("readIntent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readIntent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("targetType"u8)) + { + targetType = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetAuthenticationType"u8)) + { + targetAuthenticationType = new TargetAuthenticationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetVault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetVault = TargetAuthenticationVaultSecret.DeserializeTargetAuthenticationVaultSecret(property.Value, options); + continue; + } + if (property.NameEquals("connectionServerName"u8)) + { + connectionServerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SqlDBSingleDatabaseTargetProperties( + targetType, + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData, + sqlDbResourceId, + readIntent); + } + + 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(SqlDBSingleDatabaseTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + SqlDBSingleDatabaseTargetProperties 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 DeserializeSqlDBSingleDatabaseTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SqlDBSingleDatabaseTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.cs new file mode 100644 index 000000000000..1888018e4568 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDBSingleDatabaseTargetProperties.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The properties specific to a database in Azure SQL Database. + public partial class SqlDBSingleDatabaseTargetProperties : DatabaseWatcherTargetProperties + { + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The Azure resource ID of an Azure SQL DB database target. + /// or is null. + public SqlDBSingleDatabaseTargetProperties(TargetAuthenticationType targetAuthenticationType, string connectionServerName, ResourceIdentifier sqlDbResourceId) : base(targetAuthenticationType, connectionServerName) + { + Argument.AssertNotNull(connectionServerName, nameof(connectionServerName)); + Argument.AssertNotNull(sqlDbResourceId, nameof(sqlDbResourceId)); + + SqlDbResourceId = sqlDbResourceId; + TargetType = "SqlDb"; + } + + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + /// The Azure resource ID of an Azure SQL DB database target. + /// Set to true to monitor a high availability replica of specified target, if any. + internal SqlDBSingleDatabaseTargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, TargetAuthenticationVaultSecret targetVault, string connectionServerName, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, ResourceIdentifier sqlDbResourceId, bool? readIntent) : base(targetType, targetAuthenticationType, targetVault, connectionServerName, provisioningState, serializedAdditionalRawData) + { + SqlDbResourceId = sqlDbResourceId; + ReadIntent = readIntent; + TargetType = targetType ?? "SqlDb"; + } + + /// Initializes a new instance of for deserialization. + internal SqlDBSingleDatabaseTargetProperties() + { + } + + /// The Azure resource ID of an Azure SQL DB database target. + public ResourceIdentifier SqlDbResourceId { get; set; } + /// Set to true to monitor a high availability replica of specified target, if any. + public bool? ReadIntent { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.Serialization.cs new file mode 100644 index 000000000000..cac7b15c5713 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.Serialization.cs @@ -0,0 +1,189 @@ +// 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.DatabaseWatcher.Models +{ + public partial class SqlMITargetProperties : 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(SqlMITargetProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("sqlMiResourceId"u8); + writer.WriteStringValue(SqlMiResourceId); + if (Optional.IsDefined(ConnectionTcpPort)) + { + writer.WritePropertyName("connectionTcpPort"u8); + writer.WriteNumberValue(ConnectionTcpPort.Value); + } + if (Optional.IsDefined(ReadIntent)) + { + writer.WritePropertyName("readIntent"u8); + writer.WriteBooleanValue(ReadIntent.Value); + } + } + + SqlMITargetProperties 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(SqlMITargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSqlMITargetProperties(document.RootElement, options); + } + + internal static SqlMITargetProperties DeserializeSqlMITargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier sqlMiResourceId = default; + int? connectionTcpPort = default; + bool? readIntent = default; + string targetType = default; + TargetAuthenticationType targetAuthenticationType = default; + TargetAuthenticationVaultSecret targetVault = default; + string connectionServerName = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sqlMiResourceId"u8)) + { + sqlMiResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectionTcpPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectionTcpPort = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("readIntent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + readIntent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("targetType"u8)) + { + targetType = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetAuthenticationType"u8)) + { + targetAuthenticationType = new TargetAuthenticationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetVault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetVault = TargetAuthenticationVaultSecret.DeserializeTargetAuthenticationVaultSecret(property.Value, options); + continue; + } + if (property.NameEquals("connectionServerName"u8)) + { + connectionServerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SqlMITargetProperties( + targetType, + targetAuthenticationType, + targetVault, + connectionServerName, + provisioningState, + serializedAdditionalRawData, + sqlMiResourceId, + connectionTcpPort, + readIntent); + } + + 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(SqlMITargetProperties)} does not support writing '{options.Format}' format."); + } + } + + SqlMITargetProperties 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 DeserializeSqlMITargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SqlMITargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.cs new file mode 100644 index 000000000000..d09e3c8a7235 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlMITargetProperties.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The properties specific to Azure SQL Managed Instance targets. + public partial class SqlMITargetProperties : DatabaseWatcherTargetProperties + { + /// Initializes a new instance of . + /// The type of authentication to use when connecting to a target. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The Azure resource ID of an Azure SQL Managed Instance target. + /// or is null. + public SqlMITargetProperties(TargetAuthenticationType targetAuthenticationType, string connectionServerName, ResourceIdentifier sqlMiResourceId) : base(targetAuthenticationType, connectionServerName) + { + Argument.AssertNotNull(connectionServerName, nameof(connectionServerName)); + Argument.AssertNotNull(sqlMiResourceId, nameof(sqlMiResourceId)); + + SqlMiResourceId = sqlMiResourceId; + TargetType = "SqlMi"; + } + + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + /// The Azure resource ID of an Azure SQL Managed Instance target. + /// The TCP port number to optionally use in the connection string when connecting to an Azure SQL Managed Instance target. + /// Set to true to monitor a high availability replica of specified target, if any. + internal SqlMITargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, TargetAuthenticationVaultSecret targetVault, string connectionServerName, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData, ResourceIdentifier sqlMiResourceId, int? connectionTcpPort, bool? readIntent) : base(targetType, targetAuthenticationType, targetVault, connectionServerName, provisioningState, serializedAdditionalRawData) + { + SqlMiResourceId = sqlMiResourceId; + ConnectionTcpPort = connectionTcpPort; + ReadIntent = readIntent; + TargetType = targetType ?? "SqlMi"; + } + + /// Initializes a new instance of for deserialization. + internal SqlMITargetProperties() + { + } + + /// The Azure resource ID of an Azure SQL Managed Instance target. + public ResourceIdentifier SqlMiResourceId { get; set; } + /// The TCP port number to optionally use in the connection string when connecting to an Azure SQL Managed Instance target. + public int? ConnectionTcpPort { get; set; } + /// Set to true to monitor a high availability replica of specified target, if any. + public bool? ReadIntent { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationType.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationType.cs new file mode 100644 index 000000000000..c75adb8f1d8a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationType.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.DatabaseWatcher.Models +{ + /// The type of authentication to use when connecting to a target. + public readonly partial struct TargetAuthenticationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TargetAuthenticationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AadValue = "Aad"; + private const string SqlValue = "Sql"; + + /// The Azure Active Directory authentication. + public static TargetAuthenticationType Aad { get; } = new TargetAuthenticationType(AadValue); + /// The SQL password authentication. + public static TargetAuthenticationType Sql { get; } = new TargetAuthenticationType(SqlValue); + /// Determines if two values are the same. + public static bool operator ==(TargetAuthenticationType left, TargetAuthenticationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TargetAuthenticationType left, TargetAuthenticationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator TargetAuthenticationType(string value) => new TargetAuthenticationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TargetAuthenticationType other && Equals(other); + /// + public bool Equals(TargetAuthenticationType 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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.Serialization.cs new file mode 100644 index 000000000000..dd35e5fd1460 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.Serialization.cs @@ -0,0 +1,155 @@ +// 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.DatabaseWatcher.Models +{ + public partial class TargetAuthenticationVaultSecret : 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(TargetAuthenticationVaultSecret)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AkvResourceId)) + { + writer.WritePropertyName("akvResourceId"u8); + writer.WriteStringValue(AkvResourceId); + } + if (Optional.IsDefined(AkvTargetUser)) + { + writer.WritePropertyName("akvTargetUser"u8); + writer.WriteStringValue(AkvTargetUser); + } + if (Optional.IsDefined(AkvTargetPassword)) + { + writer.WritePropertyName("akvTargetPassword"u8); + writer.WriteStringValue(AkvTargetPassword); + } + 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 + } + } + } + + TargetAuthenticationVaultSecret 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(TargetAuthenticationVaultSecret)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetAuthenticationVaultSecret(document.RootElement, options); + } + + internal static TargetAuthenticationVaultSecret DeserializeTargetAuthenticationVaultSecret(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier akvResourceId = default; + string akvTargetUser = default; + string akvTargetPassword = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("akvResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + akvResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("akvTargetUser"u8)) + { + akvTargetUser = property.Value.GetString(); + continue; + } + if (property.NameEquals("akvTargetPassword"u8)) + { + akvTargetPassword = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetAuthenticationVaultSecret(akvResourceId, akvTargetUser, akvTargetPassword, 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(TargetAuthenticationVaultSecret)} does not support writing '{options.Format}' format."); + } + } + + TargetAuthenticationVaultSecret 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 DeserializeTargetAuthenticationVaultSecret(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetAuthenticationVaultSecret)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.cs new file mode 100644 index 000000000000..e25c799d6315 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetAuthenticationVaultSecret.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The vault specific details required if using SQL authentication to connect to a target. + public partial class TargetAuthenticationVaultSecret + { + /// + /// 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 TargetAuthenticationVaultSecret() + { + } + + /// Initializes a new instance of . + /// The Azure resource ID of the Key Vault instance storing database authentication secrets. + /// The path to the Key Vault secret storing the login name (aka user name, aka account name) for authentication to a target. + /// The path to the Key Vault secret storing the password for authentication to a target. + /// Keeps track of any properties unknown to the library. + internal TargetAuthenticationVaultSecret(ResourceIdentifier akvResourceId, string akvTargetUser, string akvTargetPassword, IDictionary serializedAdditionalRawData) + { + AkvResourceId = akvResourceId; + AkvTargetUser = akvTargetUser; + AkvTargetPassword = akvTargetPassword; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Azure resource ID of the Key Vault instance storing database authentication secrets. + public ResourceIdentifier AkvResourceId { get; set; } + /// The path to the Key Vault secret storing the login name (aka user name, aka account name) for authentication to a target. + public string AkvTargetUser { get; set; } + /// The path to the Key Vault secret storing the password for authentication to a target. + public string AkvTargetPassword { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.Serialization.cs new file mode 100644 index 000000000000..8c05cf9fef9a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.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.DatabaseWatcher.Models +{ + internal partial class TargetListResult : 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(TargetListResult)} 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 + } + } + } + + TargetListResult 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(TargetListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetListResult(document.RootElement, options); + } + + internal static TargetListResult DeserializeTargetListResult(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(DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(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 TargetListResult(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(TargetListResult)} does not support writing '{options.Format}' format."); + } + } + + TargetListResult 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 DeserializeTargetListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.cs new file mode 100644 index 000000000000..5c1e5282781a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.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.DatabaseWatcher.Models +{ + /// The response of a Target list operation. + internal partial class TargetListResult + { + /// + /// 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 items on this page. + /// is null. + internal TargetListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Target items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal TargetListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetListResult() + { + } + + /// The Target items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.Serialization.cs new file mode 100644 index 000000000000..50d24149eb83 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.Serialization.cs @@ -0,0 +1,148 @@ +// 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.DatabaseWatcher.Models +{ + internal partial class UnknownDatabaseWatcherTargetProperties : 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(DatabaseWatcherTargetProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + DatabaseWatcherTargetProperties 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(DatabaseWatcherTargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseWatcherTargetProperties(document.RootElement, options); + } + + internal static UnknownDatabaseWatcherTargetProperties DeserializeUnknownDatabaseWatcherTargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string targetType = "Unknown"; + TargetAuthenticationType targetAuthenticationType = default; + TargetAuthenticationVaultSecret targetVault = default; + string connectionServerName = default; + DatabaseWatcherResourceProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetType"u8)) + { + targetType = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetAuthenticationType"u8)) + { + targetAuthenticationType = new TargetAuthenticationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("targetVault"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetVault = TargetAuthenticationVaultSecret.DeserializeTargetAuthenticationVaultSecret(property.Value, options); + continue; + } + if (property.NameEquals("connectionServerName"u8)) + { + connectionServerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DatabaseWatcherResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDatabaseWatcherTargetProperties( + targetType, + targetAuthenticationType, + targetVault, + connectionServerName, + 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(DatabaseWatcherTargetProperties)} does not support writing '{options.Format}' format."); + } + } + + DatabaseWatcherTargetProperties 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 DeserializeDatabaseWatcherTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseWatcherTargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.cs new file mode 100644 index 000000000000..afc4a5f4000e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownDatabaseWatcherTargetProperties.cs @@ -0,0 +1,33 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// Unknown version of DatabaseWatcherTargetProperties. + internal partial class UnknownDatabaseWatcherTargetProperties : DatabaseWatcherTargetProperties + { + /// Initializes a new instance of . + /// Discriminator property for DatabaseWatcherTargetProperties. + /// The type of authentication to use when connecting to a target. + /// To use SQL authentication when connecting to targets, specify the vault where the login name and password secrets are stored. + /// The FQDN host name of the server to use in the connection string when connecting to a target. For example, for an Azure SQL logical server in the Azure commercial cloud, the value might be 'sql-logical-server-22092780.database.windows.net'; for an Azure SQL managed instance in the Azure commercial cloud, the value might be 'sql-mi-39441134.767d5869f605.database.windows.net'. Port number and instance name must be specified separately. + /// The provisioning state of the resource. + /// Keeps track of any properties unknown to the library. + internal UnknownDatabaseWatcherTargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, TargetAuthenticationVaultSecret targetVault, string connectionServerName, DatabaseWatcherResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(targetType, targetAuthenticationType, targetVault, connectionServerName, provisioningState, serializedAdditionalRawData) + { + TargetType = targetType ?? "Unknown"; + } + + /// Initializes a new instance of for deserialization. + internal UnknownDatabaseWatcherTargetProperties() + { + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.Serialization.cs new file mode 100644 index 000000000000..8e48f174a5f8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.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.DatabaseWatcher.Models +{ + internal partial class WatcherListResult : 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(WatcherListResult)} 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 + } + } + } + + WatcherListResult 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(WatcherListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWatcherListResult(document.RootElement, options); + } + + internal static WatcherListResult DeserializeWatcherListResult(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(DatabaseWatcherData.DeserializeDatabaseWatcherData(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 WatcherListResult(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(WatcherListResult)} does not support writing '{options.Format}' format."); + } + } + + WatcherListResult 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 DeserializeWatcherListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WatcherListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.cs new file mode 100644 index 000000000000..f3d8b4e595b7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.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.DatabaseWatcher.Models +{ + /// The response of a Watcher list operation. + internal partial class WatcherListResult + { + /// + /// 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 Watcher items on this page. + /// is null. + internal WatcherListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Watcher items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal WatcherListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WatcherListResult() + { + } + + /// The Watcher items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..caef5792a786 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.Serialization.cs @@ -0,0 +1,148 @@ +// 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.DatabaseWatcher.Models +{ + public partial class WatcherUpdateProperties : 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(WatcherUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Datastore)) + { + writer.WritePropertyName("datastore"u8); + writer.WriteObjectValue(Datastore, options); + } + if (Optional.IsDefined(DefaultAlertRuleIdentityResourceId)) + { + writer.WritePropertyName("defaultAlertRuleIdentityResourceId"u8); + writer.WriteStringValue(DefaultAlertRuleIdentityResourceId); + } + 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 + } + } + } + + WatcherUpdateProperties 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(WatcherUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWatcherUpdateProperties(document.RootElement, options); + } + + internal static WatcherUpdateProperties DeserializeWatcherUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DatabaseWatcherDatastore datastore = default; + ResourceIdentifier defaultAlertRuleIdentityResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("datastore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + datastore = DatabaseWatcherDatastore.DeserializeDatabaseWatcherDatastore(property.Value, options); + continue; + } + if (property.NameEquals("defaultAlertRuleIdentityResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultAlertRuleIdentityResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WatcherUpdateProperties(datastore, defaultAlertRuleIdentityResourceId, 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(WatcherUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + WatcherUpdateProperties 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 DeserializeWatcherUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WatcherUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.cs new file mode 100644 index 000000000000..ac87f10d01ea --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher.Models +{ + /// The updatable properties of the Watcher. + public partial class WatcherUpdateProperties + { + /// + /// 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 WatcherUpdateProperties() + { + } + + /// Initializes a new instance of . + /// The data store for collected monitoring data. + /// The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + /// Keeps track of any properties unknown to the library. + internal WatcherUpdateProperties(DatabaseWatcherDatastore datastore, ResourceIdentifier defaultAlertRuleIdentityResourceId, IDictionary serializedAdditionalRawData) + { + Datastore = datastore; + DefaultAlertRuleIdentityResourceId = defaultAlertRuleIdentityResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The data store for collected monitoring data. + public DatabaseWatcherDatastore Datastore { get; set; } + /// The resource ID of a user-assigned managed identity that will be assigned to a new alert rule. + public ResourceIdentifier DefaultAlertRuleIdentityResourceId { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ProviderConstants.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..4bbac7bcb68c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/AlertRuleResourcesRestOperations.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/AlertRuleResourcesRestOperations.cs new file mode 100644 index 000000000000..8bf379151a39 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/AlertRuleResourcesRestOperations.cs @@ -0,0 +1,523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DatabaseWatcher.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal partial class AlertRuleResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AlertRuleResourcesRestOperations. + /// 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 AlertRuleResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-02"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherAlertRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherAlertRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherAlertRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherAlertRuleData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName, DatabaseWatcherAlertRuleData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName, DatabaseWatcherAlertRuleData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, 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 AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseWatcherAlertRuleData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, DatabaseWatcherAlertRuleData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseWatcherAlertRuleData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherAlertRuleData.DeserializeDatabaseWatcherAlertRuleData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources/", false); + uri.AppendPath(alertRuleResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a AlertRuleResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The alert rule proxy resource name. + /// 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 watcherName, string alertRuleResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByParentRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/alertRuleResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AlertRuleResource resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByParentAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AlertRuleResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AlertRuleResourceListResult.DeserializeAlertRuleResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AlertRuleResource resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByParent(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AlertRuleResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AlertRuleResourceListResult.DeserializeAlertRuleResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByParentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + 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 AlertRuleResource resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByParentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AlertRuleResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AlertRuleResourceListResult.DeserializeAlertRuleResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AlertRuleResource resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByParentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AlertRuleResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AlertRuleResourceListResult.DeserializeAlertRuleResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/HealthValidationsRestOperations.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/HealthValidationsRestOperations.cs new file mode 100644 index 000000000000..de174dbce59c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/HealthValidationsRestOperations.cs @@ -0,0 +1,415 @@ +// 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.DatabaseWatcher.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal partial class HealthValidationsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of HealthValidationsRestOperations. + /// 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 HealthValidationsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-02"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations/", false); + uri.AppendPath(healthValidationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations/", false); + uri.AppendPath(healthValidationName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a HealthValidation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The health validation resource name. + /// 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 watcherName, string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, healthValidationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherHealthValidationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherHealthValidationData.DeserializeDatabaseWatcherHealthValidationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherHealthValidationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a HealthValidation. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The health validation resource name. + /// 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 watcherName, string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, healthValidationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherHealthValidationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherHealthValidationData.DeserializeDatabaseWatcherHealthValidationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherHealthValidationData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByParentRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List HealthValidation resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByParentAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HealthValidationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HealthValidationListResult.DeserializeHealthValidationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List HealthValidation resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByParent(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HealthValidationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HealthValidationListResult.DeserializeHealthValidationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateStartValidationRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations/", false); + uri.AppendPath(healthValidationName, true); + uri.AppendPath("/startValidation", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateStartValidationRequest(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/healthValidations/", false); + uri.AppendPath(healthValidationName, true); + uri.AppendPath("/startValidation", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Starts health validation for a watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The health validation resource name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task StartValidationAsync(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var message = CreateStartValidationRequest(subscriptionId, resourceGroupName, watcherName, healthValidationName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Starts health validation for a watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The health validation resource name. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response StartValidation(string subscriptionId, string resourceGroupName, string watcherName, string healthValidationName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(healthValidationName, nameof(healthValidationName)); + + using var message = CreateStartValidationRequest(subscriptionId, resourceGroupName, watcherName, healthValidationName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByParentNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByParentNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + 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 HealthValidation resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByParentNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + HealthValidationListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = HealthValidationListResult.DeserializeHealthValidationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List HealthValidation resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByParentNextPage(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByParentNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + HealthValidationListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = HealthValidationListResult.DeserializeHealthValidationListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs new file mode 100644 index 000000000000..630ad61fb810 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/SharedPrivateLinkResourcesRestOperations.cs @@ -0,0 +1,513 @@ +// 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.DatabaseWatcher.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal partial class SharedPrivateLinkResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SharedPrivateLinkResourcesRestOperations. + /// 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 SharedPrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-02"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 watcherName, string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherSharedPrivateLinkResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherSharedPrivateLinkResourceData.DeserializeDatabaseWatcherSharedPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherSharedPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 watcherName, string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherSharedPrivateLinkResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherSharedPrivateLinkResourceData.DeserializeDatabaseWatcherSharedPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherSharedPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, 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 SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 CreateAsync(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName, 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 SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 Create(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName, DatabaseWatcherSharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources/", false); + uri.AppendPath(sharedPrivateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 watcherName, string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + 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 SharedPrivateLinkResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The Shared Private Link resource name. + /// 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 watcherName, string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByWatcherRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByWatcherRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/sharedPrivateLinkResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List SharedPrivateLinkResource resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWatcherAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SharedPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SharedPrivateLinkResourceListResult.DeserializeSharedPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SharedPrivateLinkResource resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWatcher(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SharedPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SharedPrivateLinkResourceListResult.DeserializeSharedPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByWatcherNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByWatcherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + 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 SharedPrivateLinkResource resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWatcherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SharedPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SharedPrivateLinkResourceListResult.DeserializeSharedPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List SharedPrivateLinkResource resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWatcherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SharedPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SharedPrivateLinkResourceListResult.DeserializeSharedPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/TargetsRestOperations.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/TargetsRestOperations.cs new file mode 100644 index 000000000000..b040d20e85c8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/TargetsRestOperations.cs @@ -0,0 +1,523 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.DatabaseWatcher.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal partial class TargetsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of TargetsRestOperations. + /// 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 TargetsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-02"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string targetName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string watcherName, string targetName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, targetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherTargetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherTargetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName, targetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherTargetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherTargetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string targetName, DatabaseWatcherTargetData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string watcherName, string targetName, DatabaseWatcherTargetData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, 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 Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, targetName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseWatcherTargetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, DatabaseWatcherTargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, targetName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + DatabaseWatcherTargetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherTargetData.DeserializeDatabaseWatcherTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string targetName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string watcherName, string targetName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets/", false); + uri.AppendPath(targetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, targetName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Target. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The target resource name. + /// 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 watcherName, string targetName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName, targetName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByWatcherRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByWatcherRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/targets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Target resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWatcherAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TargetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TargetListResult.DeserializeTargetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Target resources by Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWatcher(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TargetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TargetListResult.DeserializeTargetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByWatcherNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByWatcherNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string watcherName) + { + 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 Target resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListByWatcherNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TargetListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TargetListResult.DeserializeTargetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Target resources by Watcher. + /// 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 database watcher name. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListByWatcherNextPage(string nextLink, string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateListByWatcherNextPageRequest(nextLink, subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TargetListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TargetListResult.DeserializeTargetListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/WatchersRestOperations.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/WatchersRestOperations.cs new file mode 100644 index 000000000000..ea19e36187cc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/RestOperations/WatchersRestOperations.cs @@ -0,0 +1,895 @@ +// 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.DatabaseWatcher.Models; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal partial class WatchersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WatchersRestOperations. + /// 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 WatchersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2025-01-02"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DatabaseWatcherData.DeserializeDatabaseWatcherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DatabaseWatcherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DatabaseWatcherData.DeserializeDatabaseWatcherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DatabaseWatcherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, DatabaseWatcherData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string watcherName, DatabaseWatcherData 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, 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 Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, DatabaseWatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, 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 Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, DatabaseWatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, watcherName, 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 watcherName, DatabaseWatcherPatch 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string watcherName, DatabaseWatcherPatch patch) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, 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(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, DatabaseWatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, watcherName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, DatabaseWatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, watcherName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName); + 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 Watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// 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 watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, watcherName); + _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.DatabaseWatcher/watchers", 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.DatabaseWatcher/watchers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WatcherListResult.DeserializeWatcherListResult(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.DatabaseWatcher/watchers", 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.DatabaseWatcher/watchers", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateStartRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/start", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateStartRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/start", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// The action to start monitoring all targets configured for a database watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task StartAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateStartRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// The action to start monitoring all targets configured for a database watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Start(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateStartRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateStopRequestUri(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/stop", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateStopRequest(string subscriptionId, string resourceGroupName, string watcherName) + { + 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.DatabaseWatcher/watchers/", false); + uri.AppendPath(watcherName, true); + uri.AppendPath("/stop", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// The action to stop monitoring all targets configured for a database watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task StopAsync(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateStopRequest(subscriptionId, resourceGroupName, watcherName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// The action to stop monitoring all targets configured for a database watcher. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The database watcher name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Stop(string subscriptionId, string resourceGroupName, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + + using var message = CreateStopRequest(subscriptionId, resourceGroupName, watcherName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 200: + return 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 Watcher 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: + { + WatcherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WatcherListResult.DeserializeWatcherListResult(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 Watcher 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: + { + WatcherListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Watcher 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: + { + WatcherListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = WatcherListResult.DeserializeWatcherListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Properties/AssemblyInfo.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..700c78e5dd7e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/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.DatabaseWatcher.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("DatabaseWatcher")] diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/Azure.ResourceManager.DatabaseWatcher.Tests.csproj b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/Azure.ResourceManager.DatabaseWatcher.Tests.csproj new file mode 100644 index 000000000000..4107c22780fe --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/Azure.ResourceManager.DatabaseWatcher.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestBase.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestBase.cs new file mode 100644 index 000000000000..752ee1ad5c2e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestBase.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.DatabaseWatcher.Tests +{ + public class DatabaseWatcherManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected DatabaseWatcherManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected DatabaseWatcherManagementTestBase(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/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestEnvironment.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestEnvironment.cs new file mode 100644 index 000000000000..8c72583b0fea --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tests/DatabaseWatcherManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.DatabaseWatcher.Tests +{ + public class DatabaseWatcherManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tsp-location.yaml b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tsp-location.yaml new file mode 100644 index 000000000000..d66713b5570e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasewatcher/DatabaseWatcher.Management +commit: c3af53234d2706c954855e52908b1358d8bdd5dd +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/databasewatcher/ci.mgmt.yml b/sdk/databasewatcher/ci.mgmt.yml new file mode 100644 index 000000000000..939cabda31dd --- /dev/null +++ b/sdk/databasewatcher/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/databasewatcher /ci.mgmt.yml + - sdk/databasewatcher /Azure.ResourceManager.DatabaseWatcher / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: databasewatcher + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.DatabaseWatcher + safeName: AzureResourceManagerDatabaseWatcher diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..77d5bcb09ccb 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -56,6 +56,7 @@ trigger: - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/costmanagement/Azure.ResourceManager.CostManagement - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher - sdk/databox/Azure.ResourceManager.DataBox - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - sdk/datadog/Azure.ResourceManager.Datadog @@ -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 @@ -262,6 +263,7 @@ pr: - sdk/cosmosdbforpostgresql/Azure.ResourceManager.CosmosDBForPostgreSql - sdk/costmanagement/Azure.ResourceManager.CostManagement - sdk/customer-insights/Azure.ResourceManager.CustomerInsights + - sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher - sdk/databox/Azure.ResourceManager.DataBox - sdk/databoxedge/Azure.ResourceManager.DataBoxEdge - sdk/datadog/Azure.ResourceManager.Datadog @@ -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/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/