From 199ec2ecf117118e8d23cad244900f3b74563cb2 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 28 Feb 2025 19:18:30 +0000 Subject: [PATCH] CodeGen from PR 32741 in Azure/azure-rest-api-specs Merge 4e647cbdfe5ee9cf8daff324ba834d9bf2447cfc into b311f3284390c451f05be6c20ead51740ece56b7 --- ...re.ResourceManager.AgriculturePlatform.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 ++ ...ourceManager.AgriculturePlatform.net8.0.cs | 321 +++++ ...ager.AgriculturePlatform.netstandard2.0.cs | 321 +++++ .../assets.json | 7 + ...Manager.AgriculturePlatform.Samples.csproj | 13 + .../Samples/Sample_AgriServiceResource.cs | 166 +++ .../Sample_AgriServiceResourceCollection.cs | 226 ++++ .../Sample_SubscriptionResourceExtensions.cs | 50 + ...ResourceManager.AgriculturePlatform.csproj | 8 + .../AgriServiceResource.Serialization.cs | 26 + .../src/Generated/AgriServiceResource.cs | 783 +++++++++++ .../AgriServiceResourceCollection.cs | 494 +++++++ .../AgriServiceResourceData.Serialization.cs | 212 +++ .../src/Generated/AgriServiceResourceData.cs | 91 ++ .../ArmAgriculturePlatformModelFactory.cs | 139 ++ .../AgriculturePlatformExtensions.cs | 219 ++++ .../MockableAgriculturePlatformArmClient.cs | 49 + ...griculturePlatformResourceGroupResource.cs | 105 ++ ...AgriculturePlatformSubscriptionResource.cs | 102 ++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 +++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../AgriServiceResourceOperationSource.cs | 38 + .../AgriculturePlatformArmOperation.cs | 94 ++ .../AgriculturePlatformArmOperationOfT.cs | 100 ++ .../Models/AgriServiceConfig.Serialization.cs | 203 +++ .../src/Generated/Models/AgriServiceConfig.cs | 89 ++ ...ServiceResourceListResult.Serialization.cs | 151 +++ .../Models/AgriServiceResourceListResult.cs | 80 ++ .../AgriServiceResourcePatch.Serialization.cs | 192 +++ .../Models/AgriServiceResourcePatch.cs | 79 ++ ...ServiceResourceProperties.Serialization.cs | 219 ++++ .../Models/AgriServiceResourceProperties.cs | 90 ++ ...eResourceUpdateProperties.Serialization.cs | 183 +++ .../AgriServiceResourceUpdateProperties.cs | 75 ++ .../AgriculturePlatformSku.Serialization.cs | 184 +++ .../Models/AgriculturePlatformSku.cs | 91 ++ ...griculturePlatformSkuTier.Serialization.cs | 32 + .../Models/AgriculturePlatformSkuTier.cs | 22 + .../Generated/Models/AuthCredentialsKind.cs | 51 + ...bleAgriSolutionListResult.Serialization.cs | 136 ++ .../Models/AvailableAgriSolutionListResult.cs | 76 ++ ...ataConnectorCredentialMap.Serialization.cs | 134 ++ .../Models/DataConnectorCredentialMap.cs | 82 ++ .../DataConnectorCredentials.Serialization.cs | 183 +++ .../Models/DataConnectorCredentials.cs | 81 ++ ...gerForAgricultureSolution.Serialization.cs | 210 +++ .../DataManagerForAgricultureSolution.cs | 131 ++ .../InstalledSolutionMap.Serialization.cs | 134 ++ .../Generated/Models/InstalledSolutionMap.cs | 82 ++ ...edOnBehalfOfConfiguration.Serialization.cs | 140 ++ .../Models/ManagedOnBehalfOfConfiguration.cs | 74 ++ .../MarketPlaceOfferDetails.Serialization.cs | 134 ++ .../Models/MarketPlaceOfferDetails.cs | 82 ++ .../src/Generated/Models/ProvisioningState.cs | 66 + .../Models/Solution.Serialization.cs | 191 +++ .../src/Generated/Models/Solution.cs | 85 ++ .../src/Generated/ProviderConstants.cs | 16 + .../AgriServiceRestOperations.cs | 817 ++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + .../AgriculturePlatformManagementTestBase.cs | 45 + ...ulturePlatformManagementTestEnvironment.cs | 11 + ...ceManager.AgriculturePlatform.Tests.csproj | 8 + .../tsp-location.yaml | 4 + sdk/agricultureplatform/ci.mgmt.yml | 26 + .../src/autorest.md | 2 +- .../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 + .../Samples/Sample_AlertRuleResource.cs | 113 ++ .../Sample_AlertRuleResourceCollection.cs | 200 +++ .../Sample_HealthValidationCollection.cs | 160 +++ .../Sample_HealthValidationResource.cs | 81 ++ .../Sample_SharedPrivateLinkResource.cs | 116 ++ ...ple_SharedPrivateLinkResourceCollection.cs | 203 +++ .../Sample_SubscriptionResourceExtensions.cs | 50 + .../Samples/Sample_TargetCollection.cs | 200 +++ .../Samples/Sample_TargetResource.cs | 113 ++ .../Samples/Sample_WatcherCollection.cs | 206 +++ .../Samples/Sample_WatcherResource.cs | 172 +++ ...ure.ResourceManager.DatabaseWatcher.csproj | 8 + .../AlertRuleResource.Serialization.cs | 26 + .../src/Generated/AlertRuleResource.cs | 355 +++++ .../Generated/AlertRuleResourceCollection.cs | 497 +++++++ .../AlertRuleResourceData.Serialization.cs | 155 +++ .../src/Generated/AlertRuleResourceData.cs | 75 ++ .../ArmDatabaseWatcherModelFactory.cs | 312 +++++ .../Extensions/DatabaseWatcherExtensions.cs | 295 +++++ .../MockableDatabaseWatcherArmClient.cs | 97 ++ ...bleDatabaseWatcherResourceGroupResource.cs | 105 ++ ...ableDatabaseWatcherSubscriptionResource.cs | 102 ++ .../Generated/HealthValidationCollection.cs | 395 ++++++ .../HealthValidationData.Serialization.cs | 155 +++ .../src/Generated/HealthValidationData.cs | 75 ++ .../HealthValidationResource.Serialization.cs | 26 + .../src/Generated/HealthValidationResource.cs | 255 ++++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 +++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../DatabaseWatcherArmOperation.cs | 94 ++ .../DatabaseWatcherArmOperationOfT.cs | 100 ++ .../HealthValidationOperationSource.cs | 38 + ...haredPrivateLinkResourceOperationSource.cs | 38 + .../WatcherOperationSource.cs | 38 + .../Models/AlertRuleCreationProperty.cs | 51 + ...ertRuleResourceListResult.Serialization.cs | 151 +++ .../Models/AlertRuleResourceListResult.cs | 80 ++ ...ertRuleResourceProperties.Serialization.cs | 180 +++ .../Models/AlertRuleResourceProperties.cs | 106 ++ .../DatabaseWatcherProvisioningState.cs | 54 + .../Models/Datastore.Serialization.cs | 192 +++ .../src/Generated/Models/Datastore.cs | 111 ++ ...ealthValidationListResult.Serialization.cs | 151 +++ .../Models/HealthValidationListResult.cs | 80 ++ ...ealthValidationProperties.Serialization.cs | 193 +++ .../Models/HealthValidationProperties.cs | 95 ++ .../src/Generated/Models/KustoOfferingType.cs | 54 + .../Models/ManagedServiceIdentityType.cs | 57 + .../ManagedServiceIdentityV4.Serialization.cs | 183 +++ .../Models/ManagedServiceIdentityV4.cs | 86 ++ .../Models/ResourceProvisioningState.cs | 54 + ...ateLinkResourceListResult.Serialization.cs | 151 +++ .../SharedPrivateLinkResourceListResult.cs | 80 ++ ...ateLinkResourceProperties.Serialization.cs | 190 +++ .../SharedPrivateLinkResourceProperties.cs | 102 ++ .../Models/SharedPrivateLinkResourceStatus.cs | 57 + ...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 + .../Models/TargetListResult.Serialization.cs | 151 +++ .../src/Generated/Models/TargetListResult.cs | 80 ++ .../Models/TargetProperties.Serialization.cs | 133 ++ .../src/Generated/Models/TargetProperties.cs | 97 ++ .../UnknownTargetProperties.Serialization.cs | 148 +++ .../Models/UnknownTargetProperties.cs | 33 + .../Models/ValidationIssue.Serialization.cs | 211 +++ .../src/Generated/Models/ValidationIssue.cs | 101 ++ .../src/Generated/Models/ValidationStatus.cs | 63 + .../Models/VaultSecret.Serialization.cs | 155 +++ .../src/Generated/Models/VaultSecret.cs | 74 ++ .../Models/WatcherListResult.Serialization.cs | 151 +++ .../src/Generated/Models/WatcherListResult.cs | 80 ++ .../Models/WatcherPatch.Serialization.cs | 174 +++ .../src/Generated/Models/WatcherPatch.cs | 74 ++ .../Models/WatcherProperties.Serialization.cs | 178 +++ .../src/Generated/Models/WatcherProperties.cs | 78 ++ .../src/Generated/Models/WatcherStatus.cs | 60 + .../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 +++++++++++++ ...SharedPrivateLinkResource.Serialization.cs | 26 + .../Generated/SharedPrivateLinkResource.cs | 347 +++++ .../SharedPrivateLinkResourceCollection.cs | 493 +++++++ ...edPrivateLinkResourceData.Serialization.cs | 155 +++ .../SharedPrivateLinkResourceData.cs | 75 ++ .../src/Generated/TargetCollection.cs | 497 +++++++ .../src/Generated/TargetData.Serialization.cs | 155 +++ .../src/Generated/TargetData.cs | 83 ++ .../Generated/TargetResource.Serialization.cs | 26 + .../src/Generated/TargetResource.cs | 355 +++++ .../src/Generated/WatcherCollection.cs | 494 +++++++ .../Generated/WatcherData.Serialization.cs | 194 +++ .../src/Generated/WatcherData.cs | 87 ++ .../WatcherResource.Serialization.cs | 26 + .../src/Generated/WatcherResource.cs | 1151 +++++++++++++++++ .../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 + .../tsp-location.yaml | 5 +- ...urceManager.DevOpsInfrastructure.net8.0.cs | 124 ++ ...ger.DevOpsInfrastructure.netstandard2.0.cs | 124 ++ .../Samples/Sample_DevOpsPoolCollection.cs | 25 +- .../Samples/Sample_DevOpsPoolResource.cs | 8 +- .../Sample_ResourceGroupResourceExtensions.cs | 2 +- .../Sample_SubscriptionResourceExtensions.cs | 31 +- .../ArmDevOpsInfrastructureModelFactory.cs | 11 + .../src/Generated/DevOpsPoolCollection.cs | 20 +- .../src/Generated/DevOpsPoolResource.cs | 28 +- .../DevOpsInfrastructureExtensions.cs | 92 +- ...vOpsInfrastructureResourceGroupResource.cs | 8 +- ...evOpsInfrastructureSubscriptionResource.cs | 97 +- .../Generated/Models/AvailabilityStatus.cs | 51 + .../Models/CertificateStoreNameOption.cs | 51 + .../CheckNameAvailability.Serialization.cs | 134 ++ .../Generated/Models/CheckNameAvailability.cs | 81 ++ .../Models/CheckNameAvailabilityReason.cs | 51 + ...eckNameAvailabilityResult.Serialization.cs | 150 +++ .../Models/CheckNameAvailabilityResult.cs | 94 ++ .../DevOpsInfrastructureResourceType.cs | 48 + .../DevOpsOrganization.Serialization.cs | 17 +- .../Generated/Models/DevOpsOrganization.cs | 6 +- .../Models/DevOpsPoolVmImage.Serialization.cs | 23 +- .../src/Generated/Models/DevOpsPoolVmImage.cs | 6 +- .../src/Generated/Models/EphemeralType.cs | 54 + ...SecretsManagementSettings.Serialization.cs | 17 +- .../Models/SecretsManagementSettings.cs | 6 +- .../ImageVersionsRestOperations.cs | 2 +- .../RestOperations/PoolsRestOperations.cs | 88 +- .../ResourceDetailsRestOperations.cs | 2 +- .../RestOperations/SkuRestOperations.cs | 2 +- .../SubscriptionUsagesRestOperations.cs | 2 +- .../tsp-location.yaml | 7 +- ....ResourceManager.SecretsStoreExtension.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 ++ ...rceManager.SecretsStoreExtension.net8.0.cs | 346 +++++ ...er.SecretsStoreExtension.netstandard2.0.cs | 346 +++++ .../assets.json | 7 + ...nager.SecretsStoreExtension.Samples.csproj | 13 + ...reKeyVaultSecretProviderClassCollection.cs | 208 +++ ...zureKeyVaultSecretProviderClassResource.cs | 120 ++ .../Samples/Sample_SecretSyncCollection.cs | 208 +++ .../Samples/Sample_SecretSyncResource.cs | 121 ++ .../Sample_SubscriptionResourceExtensions.cs | 81 ++ ...sourceManager.SecretsStoreExtension.csproj | 8 + .../ArmSecretsStoreExtensionModelFactory.cs | 145 +++ ...reKeyVaultSecretProviderClassCollection.cs | 494 +++++++ ...ltSecretProviderClassData.Serialization.cs | 195 +++ .../AzureKeyVaultSecretProviderClassData.cs | 88 ++ ...cretProviderClassResource.Serialization.cs | 26 + ...zureKeyVaultSecretProviderClassResource.cs | 707 ++++++++++ .../MockableSecretsStoreExtensionArmClient.cs | 61 + ...retsStoreExtensionResourceGroupResource.cs | 174 +++ ...cretsStoreExtensionSubscriptionResource.cs | 166 +++ .../SecretsStoreExtensionExtensions.cs | 403 ++++++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 +++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + ...VaultSecretProviderClassOperationSource.cs | 38 + .../SecretSyncOperationSource.cs | 38 + .../SecretsStoreExtensionArmOperation.cs | 94 ++ .../SecretsStoreExtensionArmOperationOfT.cs | 100 ++ ...etProviderClassListResult.Serialization.cs | 151 +++ ...reKeyVaultSecretProviderClassListResult.cs | 80 ++ ...tSecretProviderClassPatch.Serialization.cs | 159 +++ .../AzureKeyVaultSecretProviderClassPatch.cs | 70 + ...etProviderClassProperties.Serialization.cs | 174 +++ ...reKeyVaultSecretProviderClassProperties.cs | 97 ++ ...iderClassUpdateProperties.Serialization.cs | 162 +++ ...aultSecretProviderClassUpdateProperties.cs | 77 ++ ...rnetesSecretObjectMapping.Serialization.cs | 134 ++ .../Models/KubernetesSecretObjectMapping.cs | 82 ++ .../Generated/Models/KubernetesSecretType.cs | 51 + .../src/Generated/Models/ProvisioningState.cs | 54 + .../SecretSyncCondition.Serialization.cs | 199 +++ .../Generated/Models/SecretSyncCondition.cs | 98 ++ .../SecretSyncListResult.Serialization.cs | 151 +++ .../Generated/Models/SecretSyncListResult.cs | 80 ++ .../Models/SecretSyncPatch.Serialization.cs | 159 +++ .../src/Generated/Models/SecretSyncPatch.cs | 70 + .../SecretSyncProperties.Serialization.cs | 209 +++ .../Generated/Models/SecretSyncProperties.cs | 108 ++ .../Models/SecretSyncStatus.Serialization.cs | 158 +++ .../src/Generated/Models/SecretSyncStatus.cs | 70 + ...ecretSyncUpdateProperties.Serialization.cs | 197 +++ .../Models/SecretSyncUpdateProperties.cs | 82 ++ .../Generated/Models/StatusConditionType.cs | 54 + .../src/Generated/ProviderConstants.cs | 16 + ...aultSecretProviderClassesRestOperations.cs | 723 +++++++++++ .../SecretSyncsRestOperations.cs | 723 +++++++++++ .../src/Generated/SecretSyncCollection.cs | 494 +++++++ .../Generated/SecretSyncData.Serialization.cs | 195 +++ .../src/Generated/SecretSyncData.cs | 88 ++ .../SecretSyncResource.Serialization.cs | 26 + .../src/Generated/SecretSyncResource.cs | 707 ++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...Manager.SecretsStoreExtension.Tests.csproj | 8 + ...SecretsStoreExtensionManagementTestBase.cs | 45 + ...StoreExtensionManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/edgeworkloadsecurity/ci.mgmt.yml | 26 + .../Azure.ResourceManager.ImpactReporting.sln | 56 + .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 ++ ....ResourceManager.ImpactReporting.net8.0.cs | 616 +++++++++ ...eManager.ImpactReporting.netstandard2.0.cs | 616 +++++++++ .../assets.json | 7 + ...urceManager.ImpactReporting.Samples.csproj | 13 + .../Samples/Sample_ConnectorCollection.cs | 191 +++ .../Samples/Sample_ConnectorResource.cs | 106 ++ .../Sample_ImpactCategoryCollection.cs | 154 +++ .../Samples/Sample_ImpactCategoryResource.cs | 47 + .../Samples/Sample_InsightCollection.cs | 405 ++++++ .../Samples/Sample_InsightResource.cs | 174 +++ .../Sample_WorkloadImpactCollection.cs | 368 ++++++ .../Samples/Sample_WorkloadImpactResource.cs | 275 ++++ ...ure.ResourceManager.ImpactReporting.csproj | 8 + .../ArmImpactReportingModelFactory.cs | 213 +++ .../src/Generated/ConnectorCollection.cs | 494 +++++++ .../Generated/ConnectorData.Serialization.cs | 155 +++ .../src/Generated/ConnectorData.cs | 75 ++ .../ConnectorResource.Serialization.cs | 26 + .../src/Generated/ConnectorResource.cs | 343 +++++ .../Extensions/ImpactReportingExtensions.cs | 385 ++++++ .../MockableImpactReportingArmClient.cs | 85 ++ ...ableImpactReportingSubscriptionResource.cs | 243 ++++ .../src/Generated/ImpactCategoryCollection.cs | 389 ++++++ .../ImpactCategoryData.Serialization.cs | 155 +++ .../src/Generated/ImpactCategoryData.cs | 75 ++ .../ImpactCategoryResource.Serialization.cs | 26 + .../src/Generated/ImpactCategoryResource.cs | 170 +++ .../src/Generated/InsightCollection.cs | 497 +++++++ .../Generated/InsightData.Serialization.cs | 155 +++ .../src/Generated/InsightData.cs | 75 ++ .../InsightResource.Serialization.cs | 26 + .../src/Generated/InsightResource.cs | 354 +++++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/ChangeTrackingDictionary.cs | 167 +++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../ConnectorOperationSource.cs | 38 + .../ImpactReportingArmOperation.cs | 94 ++ .../ImpactReportingArmOperationOfT.cs | 100 ++ .../WorkloadImpactOperationSource.cs | 38 + .../ClientIncidentDetails.Serialization.cs | 144 +++ .../Generated/Models/ClientIncidentDetails.cs | 69 + .../src/Generated/Models/ConfidenceLevel.cs | 54 + .../Models/Connectivity.Serialization.cs | 178 +++ .../src/Generated/Models/Connectivity.cs | 100 ++ .../ConnectorListResult.Serialization.cs | 151 +++ .../Generated/Models/ConnectorListResult.cs | 80 ++ .../Models/ConnectorPatch.Serialization.cs | 133 ++ .../src/Generated/Models/ConnectorPatch.cs | 76 ++ .../ConnectorProperties.Serialization.cs | 180 +++ .../Generated/Models/ConnectorProperties.cs | 94 ++ ...ConnectorUpdateProperties.Serialization.cs | 133 ++ .../Models/ConnectorUpdateProperties.cs | 65 + .../Generated/Models/Content.Serialization.cs | 134 ++ .../src/Generated/Models/Content.cs | 82 ++ .../ErrorDetailProperties.Serialization.cs | 140 ++ .../Generated/Models/ErrorDetailProperties.cs | 69 + .../ExpectedValueRange.Serialization.cs | 134 ++ .../Generated/Models/ExpectedValueRange.cs | 78 ++ .../ImpactCategoryListResult.Serialization.cs | 151 +++ .../Models/ImpactCategoryListResult.cs | 80 ++ .../ImpactCategoryProperties.Serialization.cs | 194 +++ .../Models/ImpactCategoryProperties.cs | 92 ++ .../Models/ImpactDetails.Serialization.cs | 157 +++ .../src/Generated/Models/ImpactDetails.cs | 92 ++ .../src/Generated/Models/IncidentSource.cs | 60 + .../Models/InsightListResult.Serialization.cs | 151 +++ .../src/Generated/Models/InsightListResult.cs | 80 ++ .../Models/InsightProperties.Serialization.cs | 239 ++++ .../src/Generated/Models/InsightProperties.cs | 120 ++ ...opertiesAdditionalDetails.Serialization.cs | 118 ++ .../InsightPropertiesAdditionalDetails.cs | 60 + .../src/Generated/Models/MetricUnit.cs | 81 ++ .../Models/Performance.Serialization.cs | 195 +++ .../src/Generated/Models/Performance.cs | 81 ++ .../src/Generated/Models/Platform.cs | 48 + .../src/Generated/Models/Protocol.cs | 69 + .../src/Generated/Models/ProvisioningState.cs | 54 + .../RequiredImpactProperties.Serialization.cs | 151 +++ .../Models/RequiredImpactProperties.cs | 80 ++ .../Models/SourceOrTarget.Serialization.cs | 129 ++ .../src/Generated/Models/SourceOrTarget.cs | 65 + .../src/Generated/Models/Toolset.cs | 72 ++ .../Models/Workload.Serialization.cs | 144 +++ .../src/Generated/Models/Workload.cs | 69 + .../WorkloadImpactListResult.Serialization.cs | 151 +++ .../Models/WorkloadImpactListResult.cs | 80 ++ .../WorkloadImpactProperties.Serialization.cs | 378 ++++++ .../Models/WorkloadImpactProperties.cs | 146 +++ ...rtiesAdditionalProperties.Serialization.cs | 118 ++ ...oadImpactPropertiesAdditionalProperties.cs | 60 + .../src/Generated/ProviderConstants.cs | 16 + .../ConnectorsRestOperations.cs | 533 ++++++++ .../ImpactCategoriesRestOperations.cs | 303 +++++ .../RestOperations/InsightsRestOperations.cs | 487 +++++++ .../WorkloadImpactsRestOperations.cs | 441 +++++++ .../src/Generated/WorkloadImpactCollection.cs | 494 +++++++ .../WorkloadImpactData.Serialization.cs | 155 +++ .../src/Generated/WorkloadImpactData.cs | 75 ++ .../WorkloadImpactResource.Serialization.cs | 26 + .../src/Generated/WorkloadImpactResource.cs | 419 ++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...sourceManager.ImpactReporting.Tests.csproj | 8 + .../ImpactReportingManagementTestBase.cs | 45 + ...mpactReportingManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/impactreporting/ci.mgmt.yml | 26 + ...ure.ResourceManager.MongoCluster.net8.0.cs | 22 +- ...urceManager.MongoCluster.netstandard2.0.cs | 22 +- .../Samples/Sample_MongoClusterCollection.cs | 14 +- ...mple_MongoClusterFirewallRuleCollection.cs | 10 +- ...Sample_MongoClusterFirewallRuleResource.cs | 6 +- ...lusterPrivateEndpointConnectionResource.cs | 6 +- ...ateEndpointConnectionResourceCollection.cs | 10 +- .../Samples/Sample_MongoClusterResource.cs | 58 +- .../Sample_SubscriptionResourceExtensions.cs | 6 +- .../Generated/ArmMongoClusterModelFactory.cs | 4 +- ...ckableMongoClusterResourceGroupResource.cs | 4 +- ...ockableMongoClusterSubscriptionResource.cs | 8 +- .../Extensions/MongoClusterExtensions.cs | 12 +- .../src/Generated/Models/DataApiMode.cs | 51 + .../Models/DataApiProperties.Serialization.cs | 133 ++ .../src/Generated/Models/DataApiProperties.cs | 65 + .../MongoClusterProperties.Serialization.cs | 16 + .../Models/MongoClusterProperties.cs | 18 +- ...goClusterUpdateProperties.Serialization.cs | 16 + .../Models/MongoClusterUpdateProperties.cs | 18 +- .../src/Generated/MongoClusterCollection.cs | 20 +- .../MongoClusterFirewallRuleCollection.cs | 20 +- .../MongoClusterFirewallRuleResource.cs | 12 +- ...lusterPrivateEndpointConnectionResource.cs | 12 +- ...ateEndpointConnectionResourceCollection.cs | 20 +- .../src/Generated/MongoClusterResource.cs | 48 +- .../FirewallRulesRestOperations.cs | 2 +- .../MongoClustersRestOperations.cs | 2 +- ...rivateEndpointConnectionsRestOperations.cs | 2 +- .../PrivateLinksRestOperations.cs | 2 +- .../RestOperations/ReplicasRestOperations.cs | 2 +- .../tsp-location.yaml | 7 +- .../src/autorest.md | 52 +- sdk/resourcemanager/ci.mgmt.yml | 12 +- .../Azure.ResourceManager.Terraform.net8.0.cs | 27 +- ...esourceManager.Terraform.netstandard2.0.cs | 27 +- .../src/Generated/ArmTerraformModelFactory.cs | 13 +- .../Models/AuthorizationScopeFilter.cs | 57 + .../ExportQueryTerraform.Serialization.cs | 30 +- .../Generated/Models/ExportQueryTerraform.cs | 10 +- .../TerraformExportResult.Serialization.cs | 13 +- .../Generated/Models/TerraformExportResult.cs | 6 +- .../tsp-location.yaml | 3 +- 457 files changed, 60011 insertions(+), 243 deletions(-) create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.sln create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/CHANGELOG.md create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResource.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResourceCollection.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceCollection.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Argument.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Optional.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriServiceResourceOperationSource.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.Serialization.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ProviderConstants.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Properties/AssemblyInfo.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj create mode 100644 sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml create mode 100644 sdk/agricultureplatform/ci.mgmt.yml 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_AlertRuleResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_AlertRuleResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Azure.ResourceManager.DatabaseWatcher.csproj create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/ArmDatabaseWatcherModelFactory.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/HealthValidationCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.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/HealthValidationOperationSource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/SharedPrivateLinkResourceOperationSource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/WatcherOperationSource.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/AlertRuleResourceProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.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/Datastore.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.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/HealthValidationProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.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/ResourceProvisioningState.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/SharedPrivateLinkResourceProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceStatus.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/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/TargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationStatus.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.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/WatcherPatch.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherStatus.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/Generated/SharedPrivateLinkResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherCollection.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.Serialization.cs create mode 100644 sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.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 create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/AvailabilityStatus.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CertificateStoreNameOption.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.Serialization.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityReason.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsInfrastructureResourceType.cs create mode 100644 sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/EphemeralType.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.sln create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/CHANGELOG.md create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassCollection.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassCollection.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Argument.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Optional.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/AzureKeyVaultSecretProviderClassOperationSource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/StatusConditionType.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ProviderConstants.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.Serialization.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Properties/AssemblyInfo.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs create mode 100644 sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml create mode 100644 sdk/edgeworkloadsecurity/ci.mgmt.yml create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Azure.ResourceManager.ImpactReporting.sln create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/CHANGELOG.md create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Directory.Build.props create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/README.md create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.net8.0.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.netstandard2.0.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/assets.json create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Azure.ResourceManager.ImpactReporting.Samples.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Azure.ResourceManager.ImpactReporting.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ArmImpactReportingModelFactory.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/ImpactReportingExtensions.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingArmClient.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingSubscriptionResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Argument.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Optional.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ConnectorOperationSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperation.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperationOfT.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConfidenceLevel.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/IncidentSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/MetricUnit.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Platform.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Protocol.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Toolset.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ProviderConstants.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ConnectorsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/InsightsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Properties/AssemblyInfo.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/Azure.ResourceManager.ImpactReporting.Tests.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestBase.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestEnvironment.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tsp-location.yaml create mode 100644 sdk/impactreporting/ci.mgmt.yml create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs create mode 100644 sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs create mode 100644 sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/AuthorizationScopeFilter.cs diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.sln b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.sln new file mode 100644 index 000000000000..6ab8d706f738 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.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.AgriculturePlatform.Samples", "samples\Azure.ResourceManager.AgriculturePlatform.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.AgriculturePlatform", "src\Azure.ResourceManager.AgriculturePlatform.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.AgriculturePlatform.Tests", "tests\Azure.ResourceManager.AgriculturePlatform.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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/CHANGELOG.md b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md new file mode 100644 index 000000000000..32e0e8fbfd8c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure AgriculturePlatform 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 AgriculturePlatform management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.AgriculturePlatform --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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs new file mode 100644 index 000000000000..260a330c9fd9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs @@ -0,0 +1,321 @@ +namespace Azure.ResourceManager.AgriculturePlatform +{ + public static partial class AgriculturePlatformExtensions + { + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResource GetAgriServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetAgriServiceResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAgriServiceResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceCollection GetAgriServiceResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAgriServiceResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAgriServiceResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgriServiceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AgriServiceResource() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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 agriServiceResourceName) { 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 GetAvailableSolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableSolutionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.Models.AgriServiceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgriServiceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AgriServiceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string agriServiceResourceName, 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 agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string agriServiceResourceName, 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 AgriServiceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.AgriServiceResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + public partial class MockableAgriculturePlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformArmClient() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResource GetAgriServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAgriculturePlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformResourceGroupResource() { } + public virtual Azure.Response GetAgriServiceResource(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAgriServiceResourceAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceCollection GetAgriServiceResources() { throw null; } + } + public partial class MockableAgriculturePlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformSubscriptionResource() { } + public virtual Azure.Pageable GetAgriServiceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAgriServiceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgriculturePlatformSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriculturePlatformSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSkuTier? Tier { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku 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.AgriculturePlatform.Models.AgriculturePlatformSku 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 enum AgriculturePlatformSkuTier + { + Free = 0, + Basic = 1, + Standard = 2, + Premium = 3, + } + public partial class AgriServiceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceConfig() { } + public string AppServiceResourceId { get { throw null; } } + public string CosmosDbResourceId { get { throw null; } } + public string InstanceUri { get { throw null; } } + public string KeyVaultResourceId { get { throw null; } } + public string RedisCacheResourceId { get { throw null; } } + public string StorageAccountResourceId { get { throw null; } } + public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig 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.AgriculturePlatform.Models.AgriServiceConfig 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 AgriServiceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourcePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { 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.AgriculturePlatform.Models.AgriServiceResourcePatch 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.AgriculturePlatform.Models.AgriServiceResourcePatch 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 AgriServiceResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ManagedOnBehalfOfMoboBrokerResources { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties 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.AgriculturePlatform.Models.AgriServiceResourceProperties 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 AgriServiceResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceUpdateProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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 ArmAgriculturePlatformModelFactory + { + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig AgriServiceConfig(string instanceUri = null, string version = null, string appServiceResourceId = null, string cosmosDbResourceId = null, string storageAccountResourceId = null, string keyVaultResourceId = null, string redisCacheResourceId = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData AgriServiceResourceData(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.AgriculturePlatform.Models.AgriServiceResourceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku sku = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties AgriServiceResourceProperties(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState?), Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig config = null, System.Collections.Generic.IEnumerable managedOnBehalfOfMoboBrokerResources = null, System.Collections.Generic.IEnumerable dataConnectorCredentials = null, System.Collections.Generic.IEnumerable installedSolutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult AvailableAgriSolutionListResult(System.Collections.Generic.IEnumerable solutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, System.Collections.Generic.IEnumerable dataAccessScopes = null, Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = false) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthCredentialsKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthCredentialsKind(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind ApiKeyAuthCredentials { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind OAuthClientCredentials { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind 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.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AvailableAgriSolutionListResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AvailableAgriSolutionListResult() { } + public System.Collections.Generic.IReadOnlyList Solutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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 DataConnectorCredentialMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentialMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentialMap 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.AgriculturePlatform.Models.DataConnectorCredentialMap 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 DataConnectorCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentials() { } + public string ClientId { get { throw null; } set { } } + public string KeyName { get { throw null; } set { } } + public string KeyVaultUri { get { throw null; } set { } } + public string KeyVersion { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind? Kind { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials 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.AgriculturePlatform.Models.DataConnectorCredentials 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 DataManagerForAgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DataManagerForAgricultureSolution() { } + public string AccessAzureDataManagerForAgricultureApplicationId { get { throw null; } } + public string AccessAzureDataManagerForAgricultureApplicationName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList DataAccessScopes { get { throw null; } } + public bool IsValidateInput { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails { get { throw null; } } + public string PartnerId { get { throw null; } } + public string PartnerTenantId { get { throw null; } } + public string SaasApplicationId { get { throw null; } } + public string SolutionId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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 InstalledSolutionMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstalledSolutionMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.Solution value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.Solution Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.InstalledSolutionMap 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.AgriculturePlatform.Models.InstalledSolutionMap 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 MarketPlaceOfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MarketPlaceOfferDetails() { } + public string PublisherId { get { throw null; } } + public string SaasOfferId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails 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.AgriculturePlatform.Models.MarketPlaceOfferDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Solution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Solution() { } + public string ApplicationName { get { throw null; } set { } } + public string MarketPlacePublisherId { get { throw null; } set { } } + public string PartnerId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string SaasSubscriptionId { get { throw null; } set { } } + public string SaasSubscriptionName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.Solution 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.AgriculturePlatform.Models.Solution 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs new file mode 100644 index 000000000000..260a330c9fd9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs @@ -0,0 +1,321 @@ +namespace Azure.ResourceManager.AgriculturePlatform +{ + public static partial class AgriculturePlatformExtensions + { + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResource GetAgriServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetAgriServiceResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAgriServiceResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceCollection GetAgriServiceResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAgriServiceResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAgriServiceResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgriServiceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AgriServiceResource() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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 agriServiceResourceName) { 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 GetAvailableSolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableSolutionsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.Models.AgriServiceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgriServiceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AgriServiceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string agriServiceResourceName, 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 agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string agriServiceResourceName, 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 AgriServiceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData 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.AgriculturePlatform.AgriServiceResourceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + public partial class MockableAgriculturePlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformArmClient() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResource GetAgriServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAgriculturePlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformResourceGroupResource() { } + public virtual Azure.Response GetAgriServiceResource(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAgriServiceResourceAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceCollection GetAgriServiceResources() { throw null; } + } + public partial class MockableAgriculturePlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformSubscriptionResource() { } + public virtual Azure.Pageable GetAgriServiceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAgriServiceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgriculturePlatformSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriculturePlatformSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSkuTier? Tier { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku 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.AgriculturePlatform.Models.AgriculturePlatformSku 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 enum AgriculturePlatformSkuTier + { + Free = 0, + Basic = 1, + Standard = 2, + Premium = 3, + } + public partial class AgriServiceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceConfig() { } + public string AppServiceResourceId { get { throw null; } } + public string CosmosDbResourceId { get { throw null; } } + public string InstanceUri { get { throw null; } } + public string KeyVaultResourceId { get { throw null; } } + public string RedisCacheResourceId { get { throw null; } } + public string StorageAccountResourceId { get { throw null; } } + public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig 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.AgriculturePlatform.Models.AgriServiceConfig 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 AgriServiceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourcePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { 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.AgriculturePlatform.Models.AgriServiceResourcePatch 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.AgriculturePlatform.Models.AgriServiceResourcePatch 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 AgriServiceResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ManagedOnBehalfOfMoboBrokerResources { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties 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.AgriculturePlatform.Models.AgriServiceResourceProperties 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 AgriServiceResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceUpdateProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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 ArmAgriculturePlatformModelFactory + { + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig AgriServiceConfig(string instanceUri = null, string version = null, string appServiceResourceId = null, string cosmosDbResourceId = null, string storageAccountResourceId = null, string keyVaultResourceId = null, string redisCacheResourceId = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgriServiceResourceData AgriServiceResourceData(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.AgriculturePlatform.Models.AgriServiceResourceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku sku = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceProperties AgriServiceResourceProperties(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState?), Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceConfig config = null, System.Collections.Generic.IEnumerable managedOnBehalfOfMoboBrokerResources = null, System.Collections.Generic.IEnumerable dataConnectorCredentials = null, System.Collections.Generic.IEnumerable installedSolutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult AvailableAgriSolutionListResult(System.Collections.Generic.IEnumerable solutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, System.Collections.Generic.IEnumerable dataAccessScopes = null, Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = false) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthCredentialsKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthCredentialsKind(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind ApiKeyAuthCredentials { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind OAuthClientCredentials { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind 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.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AvailableAgriSolutionListResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AvailableAgriSolutionListResult() { } + public System.Collections.Generic.IReadOnlyList Solutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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 DataConnectorCredentialMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentialMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentialMap 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.AgriculturePlatform.Models.DataConnectorCredentialMap 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 DataConnectorCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentials() { } + public string ClientId { get { throw null; } set { } } + public string KeyName { get { throw null; } set { } } + public string KeyVaultUri { get { throw null; } set { } } + public string KeyVersion { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind? Kind { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials 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.AgriculturePlatform.Models.DataConnectorCredentials 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 DataManagerForAgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DataManagerForAgricultureSolution() { } + public string AccessAzureDataManagerForAgricultureApplicationId { get { throw null; } } + public string AccessAzureDataManagerForAgricultureApplicationName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList DataAccessScopes { get { throw null; } } + public bool IsValidateInput { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails { get { throw null; } } + public string PartnerId { get { throw null; } } + public string PartnerTenantId { get { throw null; } } + public string SaasApplicationId { get { throw null; } } + public string SolutionId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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 InstalledSolutionMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstalledSolutionMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.Solution value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.Solution Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.InstalledSolutionMap 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.AgriculturePlatform.Models.InstalledSolutionMap 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 MarketPlaceOfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MarketPlaceOfferDetails() { } + public string PublisherId { get { throw null; } } + public string SaasOfferId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails 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.AgriculturePlatform.Models.MarketPlaceOfferDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Solution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Solution() { } + public string ApplicationName { get { throw null; } set { } } + public string MarketPlacePublisherId { get { throw null; } set { } } + public string PartnerId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string SaasSubscriptionId { get { throw null; } set { } } + public string SaasSubscriptionName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.Solution 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.AgriculturePlatform.Models.Solution 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json new file mode 100644 index 000000000000..86863301e28a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/agricultureplatform/Azure.ResourceManager.AgriculturePlatform", + "Tag": "" +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj new file mode 100644 index 000000000000..7142d3cd9660 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResource.cs new file mode 100644 index 000000000000..2d941722fee5 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResource.cs @@ -0,0 +1,166 @@ +// 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.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.AgriculturePlatform.Samples +{ + public partial class Sample_AgriServiceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgriServiceResource created on azure + // for more information of creating AgriServiceResource, please refer to the document of AgriServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agriServiceResourceId = AgriServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgriServiceResource agriServiceResource = client.GetAgriServiceResource(agriServiceResourceId); + + // invoke the operation + AgriServiceResource result = await agriServiceResource.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 + AgriServiceResourceData 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_AgriServiceDelete() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgriServiceResource created on azure + // for more information of creating AgriServiceResource, please refer to the document of AgriServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agriServiceResourceId = AgriServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgriServiceResource agriServiceResource = client.GetAgriServiceResource(agriServiceResourceId); + + // invoke the operation + await agriServiceResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AgriServiceUpdate() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Update_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgriServiceResource created on azure + // for more information of creating AgriServiceResource, please refer to the document of AgriServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agriServiceResourceId = AgriServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgriServiceResource agriServiceResource = client.GetAgriServiceResource(agriServiceResourceId); + + // invoke the operation + AgriServiceResourcePatch patch = new AgriServiceResourcePatch + { + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key4771")] = new UserAssignedIdentity() +}, + }, + Sku = new AgriculturePlatformSku("tbdtdfffkar") + { + Tier = AgriculturePlatformSkuTier.Free, + Size = "iusaqqj", + Family = "hxojswlgs", + Capacity = 22, + }, + Tags = +{ +["key9006"] = "kuzlwpujbql" +}, + Properties = new AgriServiceResourceUpdateProperties + { + Config = new AgriServiceConfig(), + DataConnectorCredentials = {new DataConnectorCredentialMap("BackendAADApplicationCredentials", new DataConnectorCredentials +{ +ClientId = "dce298a8-1eec-481a-a8f9-a3cd5a8257b2", +})}, + InstalledSolutions = {new InstalledSolutionMap("bayerAgPowered.cwum", new Solution +{ +ApplicationName = "bayerAgPowered.cwum", +})}, + }, + }; + ArmOperation lro = await agriServiceResource.UpdateAsync(WaitUntil.Completed, patch); + AgriServiceResource 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 + AgriServiceResourceData 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 GetAvailableSolutions_AgriServiceListAvailableSolutions() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListAvailableSolutions_MaximumSet_Gen.json + // this example is just showing the usage of "AgriService_ListAvailableSolutions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 AgriServiceResource created on azure + // for more information of creating AgriServiceResource, please refer to the document of AgriServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agriServiceResourceId = AgriServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgriServiceResource agriServiceResource = client.GetAgriServiceResource(agriServiceResourceId); + + // invoke the operation + AvailableAgriSolutionListResult result = await agriServiceResource.GetAvailableSolutionsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResourceCollection.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResourceCollection.cs new file mode 100644 index 000000000000..a5e4402a6fc6 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgriServiceResourceCollection.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.AgriculturePlatform.Samples +{ + public partial class Sample_AgriServiceResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AgriServiceCreateOrUpdate() + { + // Generated from example definition: 2024-06-01-preview/AgriService_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgriServiceResource + AgriServiceResourceCollection collection = resourceGroupResource.GetAgriServiceResources(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + AgriServiceResourceData data = new AgriServiceResourceData(new AzureLocation("pkneuknooprpqirnugzwbkiie")) + { + Properties = new AgriServiceResourceProperties + { + Config = new AgriServiceConfig(), + DataConnectorCredentials = {new DataConnectorCredentialMap("BackendAADApplicationCredentials", new DataConnectorCredentials +{ +ClientId = "dce298a8-1eec-481a-a8f9-a3cd5a8257b2", +})}, + InstalledSolutions = {new InstalledSolutionMap("bayerAgPowered.cwum", new Solution +{ +ApplicationName = "bayerAgPowered.cwum", +})}, + }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key4955")] = new UserAssignedIdentity() +}, + }, + Sku = new AgriculturePlatformSku("kfl") + { + Tier = AgriculturePlatformSkuTier.Free, + Size = "r", + Family = "xerdhxyjwrypvxphavgrtjphtohf", + Capacity = 20, + }, + Tags = +{ +["key137"] = "oxwansfetzzgdwl" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agriServiceResourceName, data); + AgriServiceResource 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 + AgriServiceResourceData 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_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgriServiceResource + AgriServiceResourceCollection collection = resourceGroupResource.GetAgriServiceResources(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + AgriServiceResource result = await collection.GetAsync(agriServiceResourceName); + + // 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 + AgriServiceResourceData 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_AgriServiceListByResourceGroup() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgriServiceResource + AgriServiceResourceCollection collection = resourceGroupResource.GetAgriServiceResources(); + + // invoke the operation and iterate over the result + await foreach (AgriServiceResource 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 + AgriServiceResourceData 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_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgriServiceResource + AgriServiceResourceCollection collection = resourceGroupResource.GetAgriServiceResources(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + bool result = await collection.ExistsAsync(agriServiceResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgriServiceResource + AgriServiceResourceCollection collection = resourceGroupResource.GetAgriServiceResources(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + NullableResponse response = await collection.GetIfExistsAsync(agriServiceResourceName); + AgriServiceResource 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 + AgriServiceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..8d080e7ae6c5 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAgriServiceResources_AgriServiceListBySubscription() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AgriServiceResource item in subscriptionResource.GetAgriServiceResourcesAsync()) + { + // 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 + AgriServiceResourceData 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj new file mode 100644 index 000000000000..d8d4e6fdf5ce --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider AgriculturePlatform. + 1.0.0-beta.1 + azure;management;arm;resource manager;agricultureplatform + Azure.ResourceManager.AgriculturePlatform + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.Serialization.cs new file mode 100644 index 000000000000..05af6e329d2a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.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.AgriculturePlatform +{ + public partial class AgriServiceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AgriServiceResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AgriServiceResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.cs new file mode 100644 index 000000000000..c38415ebc19b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResource.cs @@ -0,0 +1,783 @@ +// 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.AgriculturePlatform.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// + /// A Class representing an AgriServiceResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAgriServiceResource method. + /// Otherwise you can get one from its parent resource using the GetAgriServiceResource method. + /// + public partial class AgriServiceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The agriServiceResourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _agriServiceResourceAgriServiceClientDiagnostics; + private readonly AgriServiceRestOperations _agriServiceResourceAgriServiceRestClient; + private readonly AgriServiceResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AgriculturePlatform/agriServices"; + + /// Initializes a new instance of the class for mocking. + protected AgriServiceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AgriServiceResource(ArmClient client, AgriServiceResourceData 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 AgriServiceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _agriServiceResourceAgriServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string agriServiceResourceAgriServiceApiVersion); + _agriServiceResourceAgriServiceRestClient = new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agriServiceResourceAgriServiceApiVersion); +#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 AgriServiceResourceData 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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Get"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Get"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Delete + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Delete"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(_agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Delete + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Delete"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AgriculturePlatformArmOperation(_agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Update + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AgriServiceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Update"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(new AgriServiceResourceOperationSource(Client), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Update + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AgriServiceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.Update"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new AgriculturePlatformArmOperation(new AgriServiceResourceOperationSource(Client), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.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; + } + } + + /// + /// Returns the list of available agri solutions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions + /// + /// + /// Operation Id + /// AgriService_ListAvailableSolutions + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAvailableSolutionsAsync(CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.GetAvailableSolutions"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.ListAvailableSolutionsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the list of available agri solutions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions + /// + /// + /// Operation Id + /// AgriService_ListAvailableSolutions + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAvailableSolutions(CancellationToken cancellationToken = default) + { + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.GetAvailableSolutions"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.ListAvailableSolutions(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResource.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 = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgriServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgriServiceResourcePatch(); + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceCollection.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceCollection.cs new file mode 100644 index 000000000000..42b85f8af389 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceCollection.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.AgriculturePlatform +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAgriServiceResources method from an instance of . + /// + public partial class AgriServiceResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _agriServiceResourceAgriServiceClientDiagnostics; + private readonly AgriServiceRestOperations _agriServiceResourceAgriServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected AgriServiceResourceCollection() + { + } + + /// 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 AgriServiceResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _agriServiceResourceAgriServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", AgriServiceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AgriServiceResource.ResourceType, out string agriServiceResourceAgriServiceApiVersion); + _agriServiceResourceAgriServiceRestClient = new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agriServiceResourceAgriServiceApiVersion); +#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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(new AgriServiceResourceOperationSource(Client), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, 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 AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data, cancellationToken); + var operation = new AgriculturePlatformArmOperation(new AgriServiceResourceOperationSource(Client), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, _agriServiceResourceAgriServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.Get"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.Get"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List AgriServiceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _agriServiceResourceAgriServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agriServiceResourceAgriServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgriServiceResource(Client, AgriServiceResourceData.DeserializeAgriServiceResourceData(e)), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, "AgriServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List AgriServiceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _agriServiceResourceAgriServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agriServiceResourceAgriServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgriServiceResource(Client, AgriServiceResourceData.DeserializeAgriServiceResourceData(e)), _agriServiceResourceAgriServiceClientDiagnostics, Pipeline, "AgriServiceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.Exists"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _agriServiceResourceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agriServiceResourceAgriServiceClientDiagnostics.CreateScope("AgriServiceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _agriServiceResourceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgriServiceResource(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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.Serialization.cs new file mode 100644 index 000000000000..6631566e5cc9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.Serialization.cs @@ -0,0 +1,212 @@ +// 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.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + public partial class AgriServiceResourceData : 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(AgriServiceResourceData)} 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); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + } + + AgriServiceResourceData 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(AgriServiceResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceData(document.RootElement, options); + } + + internal static AgriServiceResourceData DeserializeAgriServiceResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgriServiceResourceProperties properties = default; + ManagedServiceIdentity identity = default; + AgriculturePlatformSku sku = 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 = AgriServiceResourceProperties.DeserializeAgriServiceResourceProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AgriculturePlatformSku.DeserializeAgriculturePlatformSku(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 AgriServiceResourceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + sku, + 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(AgriServiceResourceData)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.cs new file mode 100644 index 000000000000..7feaf9b7fd31 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgriServiceResourceData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// + /// A class representing the AgriServiceResource data model. + /// Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + /// + public partial class AgriServiceResourceData : 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 AgriServiceResourceData(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. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AgriServiceResourceProperties properties, ManagedServiceIdentity identity, AgriculturePlatformSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgriServiceResourceData() + { + } + + /// The resource-specific properties for this resource. + public AgriServiceResourceProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AgriculturePlatformSku Sku { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs new file mode 100644 index 000000000000..5c942e4abb78 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs @@ -0,0 +1,139 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Model factory for models. + public static partial class ArmAgriculturePlatformModelFactory + { + /// 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. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static AgriServiceResourceData AgriServiceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AgriServiceResourceProperties properties = null, ManagedServiceIdentity identity = null, AgriculturePlatformSku sku = null) + { + tags ??= new Dictionary(); + + return new AgriServiceResourceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + sku, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// Config of the AgriService instance. + /// Managed On Behalf Of Configuration. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// A new instance for mocking. + public static AgriServiceResourceProperties AgriServiceResourceProperties(ProvisioningState? provisioningState = null, AgriServiceConfig config = null, IEnumerable managedOnBehalfOfMoboBrokerResources = null, IEnumerable dataConnectorCredentials = null, IEnumerable installedSolutions = null) + { + managedOnBehalfOfMoboBrokerResources ??= new List(); + dataConnectorCredentials ??= new List(); + installedSolutions ??= new List(); + + return new AgriServiceResourceProperties( + provisioningState, + config, + managedOnBehalfOfMoboBrokerResources != null ? new ManagedOnBehalfOfConfiguration(managedOnBehalfOfMoboBrokerResources?.ToList(), serializedAdditionalRawData: null) : null, + dataConnectorCredentials?.ToList(), + installedSolutions?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Instance URI of the AgriService instance. + /// Version of AgriService instance. + /// App service resource Id. + /// Cosmos Db resource Id. + /// Storage account resource Id. + /// Key vault resource Id. + /// Redis cache resource Id. + /// A new instance for mocking. + public static AgriServiceConfig AgriServiceConfig(string instanceUri = null, string version = null, string appServiceResourceId = null, string cosmosDbResourceId = null, string storageAccountResourceId = null, string keyVaultResourceId = null, string redisCacheResourceId = null) + { + return new AgriServiceConfig( + instanceUri, + version, + appServiceResourceId, + cosmosDbResourceId, + storageAccountResourceId, + keyVaultResourceId, + redisCacheResourceId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Agri solutions list. + /// A new instance for mocking. + public static AvailableAgriSolutionListResult AvailableAgriSolutionListResult(IEnumerable solutions = null) + { + solutions ??= new List(); + + return new AvailableAgriSolutionListResult(solutions?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// A new instance for mocking. + public static DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, IEnumerable dataAccessScopes = null, MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = default) + { + dataAccessScopes ??= new List(); + + return new DataManagerForAgricultureSolution( + partnerId, + solutionId, + partnerTenantId, + dataAccessScopes?.ToList(), + marketPlaceOfferDetails, + saasApplicationId, + accessAzureDataManagerForAgricultureApplicationId, + accessAzureDataManagerForAgricultureApplicationName, + isValidateInput, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Saas offer Id. + /// Publisher Id. + /// A new instance for mocking. + public static MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) + { + return new MarketPlaceOfferDetails(saasOfferId, publisherId, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs new file mode 100644 index 000000000000..33278862927b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.AgriculturePlatform.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// A class to add extension methods to Azure.ResourceManager.AgriculturePlatform. + public static partial class AgriculturePlatformExtensions + { + private static MockableAgriculturePlatformArmClient GetMockableAgriculturePlatformArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableAgriculturePlatformArmClient(client0)); + } + + private static MockableAgriculturePlatformResourceGroupResource GetMockableAgriculturePlatformResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableAgriculturePlatformResourceGroupResource(client, resource.Id)); + } + + private static MockableAgriculturePlatformSubscriptionResource GetMockableAgriculturePlatformSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableAgriculturePlatformSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AgriServiceResource GetAgriServiceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAgriculturePlatformArmClient(client).GetAgriServiceResource(id); + } + + /// + /// Gets a collection of AgriServiceResources 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 AgriServiceResources and their operations over a AgriServiceResource. + public static AgriServiceResourceCollection GetAgriServiceResources(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgriServiceResources(); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetAgriServiceResourceAsync(this ResourceGroupResource resourceGroupResource, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgriServiceResourceAsync(agriServiceResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetAgriServiceResource(this ResourceGroupResource resourceGroupResource, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgriServiceResource(agriServiceResourceName, cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAgriServiceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAgriculturePlatformSubscriptionResource(subscriptionResource).GetAgriServiceResourcesAsync(cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAgriServiceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAgriculturePlatformSubscriptionResource(subscriptionResource).GetAgriServiceResources(cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs new file mode 100644 index 000000000000..47524282c73e --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAgriculturePlatformArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformArmClient() + { + } + + /// 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 MockableAgriculturePlatformArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAgriculturePlatformArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AgriServiceResource GetAgriServiceResource(ResourceIdentifier id) + { + AgriServiceResource.ValidateResourceId(id); + return new AgriServiceResource(Client, id); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs new file mode 100644 index 000000000000..560b8c722fbe --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.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.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAgriculturePlatformResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformResourceGroupResource() + { + } + + /// 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 MockableAgriculturePlatformResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AgriServiceResources in the ResourceGroupResource. + /// An object representing collection of AgriServiceResources and their operations over a AgriServiceResource. + public virtual AgriServiceResourceCollection GetAgriServiceResources() + { + return GetCachedClient(client => new AgriServiceResourceCollection(client, Id)); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAgriServiceResourceAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + return await GetAgriServiceResources().GetAsync(agriServiceResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAgriServiceResource(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + return GetAgriServiceResources().Get(agriServiceResourceName, cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs new file mode 100644 index 000000000000..fe872ab6c746 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.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.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAgriculturePlatformSubscriptionResource : ArmResource + { + private ClientDiagnostics _agriServiceResourceAgriServiceClientDiagnostics; + private AgriServiceRestOperations _agriServiceResourceAgriServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformSubscriptionResource() + { + } + + /// 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 MockableAgriculturePlatformSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AgriServiceResourceAgriServiceClientDiagnostics => _agriServiceResourceAgriServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", AgriServiceResource.ResourceType.Namespace, Diagnostics); + private AgriServiceRestOperations AgriServiceResourceAgriServiceRestClient => _agriServiceResourceAgriServiceRestClient ??= new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AgriServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAgriServiceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgriServiceResourceAgriServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgriServiceResourceAgriServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgriServiceResource(Client, AgriServiceResourceData.DeserializeAgriServiceResourceData(e)), AgriServiceResourceAgriServiceClientDiagnostics, Pipeline, "MockableAgriculturePlatformSubscriptionResource.GetAgriServiceResources", "value", "nextLink", cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAgriServiceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgriServiceResourceAgriServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgriServiceResourceAgriServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgriServiceResource(Client, AgriServiceResourceData.DeserializeAgriServiceResourceData(e)), AgriServiceResourceAgriServiceClientDiagnostics, Pipeline, "MockableAgriculturePlatformSubscriptionResource.GetAgriServiceResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Argument.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..179c68864933 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..ecea3d3eef83 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingList.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..3d961834ccb2 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..f5b82d28d75e --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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.AgriculturePlatform +{ + internal static class ModelSerializationExtensions + { + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Optional.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..edc449f09f8a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..829294f41cb2 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriServiceResourceOperationSource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriServiceResourceOperationSource.cs new file mode 100644 index 000000000000..54bd815dce3c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriServiceResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + internal class AgriServiceResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AgriServiceResourceOperationSource(ArmClient client) + { + _client = client; + } + + AgriServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = AgriServiceResourceData.DeserializeAgriServiceResourceData(document.RootElement); + return new AgriServiceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = AgriServiceResourceData.DeserializeAgriServiceResourceData(document.RootElement); + return new AgriServiceResource(_client, data); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.cs new file mode 100644 index 000000000000..4a50bda8752b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.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.AgriculturePlatform +{ +#pragma warning disable SA1649 // File name should match first type name + internal class AgriculturePlatformArmOperation : 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 AgriculturePlatformArmOperation for mocking. + protected AgriculturePlatformArmOperation() + { + } + + internal AgriculturePlatformArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal AgriculturePlatformArmOperation(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, "AgriculturePlatformArmOperation", 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.cs new file mode 100644 index 000000000000..29ae9cc5c8ec --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.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.AgriculturePlatform +{ +#pragma warning disable SA1649 // File name should match first type name + internal class AgriculturePlatformArmOperation : 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 AgriculturePlatformArmOperation for mocking. + protected AgriculturePlatformArmOperation() + { + } + + internal AgriculturePlatformArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal AgriculturePlatformArmOperation(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, "AgriculturePlatformArmOperation", 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.Serialization.cs new file mode 100644 index 000000000000..f3247e7fd907 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.Serialization.cs @@ -0,0 +1,203 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgriServiceConfig : 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(AgriServiceConfig)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(InstanceUri)) + { + writer.WritePropertyName("instanceUri"u8); + writer.WriteStringValue(InstanceUri); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && Optional.IsDefined(AppServiceResourceId)) + { + writer.WritePropertyName("appServiceResourceId"u8); + writer.WriteStringValue(AppServiceResourceId); + } + if (options.Format != "W" && Optional.IsDefined(CosmosDbResourceId)) + { + writer.WritePropertyName("cosmosDbResourceId"u8); + writer.WriteStringValue(CosmosDbResourceId); + } + if (options.Format != "W" && Optional.IsDefined(StorageAccountResourceId)) + { + writer.WritePropertyName("storageAccountResourceId"u8); + writer.WriteStringValue(StorageAccountResourceId); + } + if (options.Format != "W" && Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + if (options.Format != "W" && Optional.IsDefined(RedisCacheResourceId)) + { + writer.WritePropertyName("redisCacheResourceId"u8); + writer.WriteStringValue(RedisCacheResourceId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriServiceConfig 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(AgriServiceConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceConfig(document.RootElement, options); + } + + internal static AgriServiceConfig DeserializeAgriServiceConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceUri = default; + string version = default; + string appServiceResourceId = default; + string cosmosDbResourceId = default; + string storageAccountResourceId = default; + string keyVaultResourceId = default; + string redisCacheResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceUri"u8)) + { + instanceUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("appServiceResourceId"u8)) + { + appServiceResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("cosmosDbResourceId"u8)) + { + cosmosDbResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountResourceId"u8)) + { + storageAccountResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVaultResourceId"u8)) + { + keyVaultResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("redisCacheResourceId"u8)) + { + redisCacheResourceId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriServiceConfig( + instanceUri, + version, + appServiceResourceId, + cosmosDbResourceId, + storageAccountResourceId, + keyVaultResourceId, + redisCacheResourceId, + 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(AgriServiceConfig)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.cs new file mode 100644 index 000000000000..46006fa91957 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceConfig.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Config of the AgriService resource instance. + public partial class AgriServiceConfig + { + /// + /// 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 AgriServiceConfig() + { + } + + /// Initializes a new instance of . + /// Instance URI of the AgriService instance. + /// Version of AgriService instance. + /// App service resource Id. + /// Cosmos Db resource Id. + /// Storage account resource Id. + /// Key vault resource Id. + /// Redis cache resource Id. + /// Keeps track of any properties unknown to the library. + internal AgriServiceConfig(string instanceUri, string version, string appServiceResourceId, string cosmosDbResourceId, string storageAccountResourceId, string keyVaultResourceId, string redisCacheResourceId, IDictionary serializedAdditionalRawData) + { + InstanceUri = instanceUri; + Version = version; + AppServiceResourceId = appServiceResourceId; + CosmosDbResourceId = cosmosDbResourceId; + StorageAccountResourceId = storageAccountResourceId; + KeyVaultResourceId = keyVaultResourceId; + RedisCacheResourceId = redisCacheResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Instance URI of the AgriService instance. + public string InstanceUri { get; } + /// Version of AgriService instance. + public string Version { get; } + /// App service resource Id. + public string AppServiceResourceId { get; } + /// Cosmos Db resource Id. + public string CosmosDbResourceId { get; } + /// Storage account resource Id. + public string StorageAccountResourceId { get; } + /// Key vault resource Id. + public string KeyVaultResourceId { get; } + /// Redis cache resource Id. + public string RedisCacheResourceId { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..133cfd29df12 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.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.AgriculturePlatform.Models +{ + internal partial class AgriServiceResourceListResult : 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(AgriServiceResourceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriServiceResourceListResult 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(AgriServiceResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceListResult(document.RootElement, options); + } + + internal static AgriServiceResourceListResult DeserializeAgriServiceResourceListResult(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(AgriServiceResourceData.DeserializeAgriServiceResourceData(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 AgriServiceResourceListResult(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(AgriServiceResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.cs new file mode 100644 index 000000000000..71dde4ca7105 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.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.AgriculturePlatform.Models +{ + /// The response of a AgriServiceResource list operation. + internal partial class AgriServiceResourceListResult + { + /// + /// 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 AgriServiceResource items on this page. + /// is null. + internal AgriServiceResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AgriServiceResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgriServiceResourceListResult() + { + } + + /// The AgriServiceResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.Serialization.cs new file mode 100644 index 000000000000..f13487f43c29 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgriServiceResourcePatch : 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(AgriServiceResourcePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriServiceResourcePatch 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(AgriServiceResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourcePatch(document.RootElement, options); + } + + internal static AgriServiceResourcePatch DeserializeAgriServiceResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + AgriculturePlatformSku sku = default; + IDictionary tags = default; + AgriServiceResourceUpdateProperties 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; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AgriculturePlatformSku.DeserializeAgriculturePlatformSku(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 = AgriServiceResourceUpdateProperties.DeserializeAgriServiceResourceUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriServiceResourcePatch(identity, sku, 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(AgriServiceResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.cs new file mode 100644 index 000000000000..5cd7e2095d84 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourcePatch.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The type used for update operations of the AgriServiceResource. + public partial class AgriServiceResourcePatch + { + /// + /// 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 AgriServiceResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourcePatch(ManagedServiceIdentity identity, AgriculturePlatformSku sku, IDictionary tags, AgriServiceResourceUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Sku = sku; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AgriculturePlatformSku Sku { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public AgriServiceResourceUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.Serialization.cs new file mode 100644 index 000000000000..58ba404529d9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgriServiceResourceProperties : 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(AgriServiceResourceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + writer.WriteObjectValue(Config, options); + } + if (options.Format != "W" && Optional.IsDefined(ManagedOnBehalfOfConfiguration)) + { + writer.WritePropertyName("managedOnBehalfOfConfiguration"u8); + writer.WriteObjectValue(ManagedOnBehalfOfConfiguration, options); + } + if (Optional.IsCollectionDefined(DataConnectorCredentials)) + { + writer.WritePropertyName("dataConnectorCredentials"u8); + writer.WriteStartArray(); + foreach (var item in DataConnectorCredentials) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(InstalledSolutions)) + { + writer.WritePropertyName("installedSolutions"u8); + writer.WriteStartArray(); + foreach (var item in InstalledSolutions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriServiceResourceProperties 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(AgriServiceResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceProperties(document.RootElement, options); + } + + internal static AgriServiceResourceProperties DeserializeAgriServiceResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + AgriServiceConfig config = default; + ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration = default; + IList dataConnectorCredentials = default; + IList installedSolutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + config = AgriServiceConfig.DeserializeAgriServiceConfig(property.Value, options); + continue; + } + if (property.NameEquals("managedOnBehalfOfConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedOnBehalfOfConfiguration = ManagedOnBehalfOfConfiguration.DeserializeManagedOnBehalfOfConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("dataConnectorCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataConnectorCredentialMap.DeserializeDataConnectorCredentialMap(item, options)); + } + dataConnectorCredentials = array; + continue; + } + if (property.NameEquals("installedSolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InstalledSolutionMap.DeserializeInstalledSolutionMap(item, options)); + } + installedSolutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriServiceResourceProperties( + provisioningState, + config, + managedOnBehalfOfConfiguration, + dataConnectorCredentials ?? new ChangeTrackingList(), + installedSolutions ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgriServiceResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.cs new file mode 100644 index 000000000000..306cb33b0b8c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Details of the Agriculture AgriDataManager. + public partial class AgriServiceResourceProperties + { + /// + /// 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 AgriServiceResourceProperties() + { + DataConnectorCredentials = new ChangeTrackingList(); + InstalledSolutions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// Config of the AgriService instance. + /// Managed On Behalf Of Configuration. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceProperties(ProvisioningState? provisioningState, AgriServiceConfig config, ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration, IList dataConnectorCredentials, IList installedSolutions, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Config = config; + ManagedOnBehalfOfConfiguration = managedOnBehalfOfConfiguration; + DataConnectorCredentials = dataConnectorCredentials; + InstalledSolutions = installedSolutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the last operation. + public ProvisioningState? ProvisioningState { get; } + /// Config of the AgriService instance. + public AgriServiceConfig Config { get; set; } + /// Managed On Behalf Of Configuration. + internal ManagedOnBehalfOfConfiguration ManagedOnBehalfOfConfiguration { get; } + /// Associated MoboBrokerResources. + public IReadOnlyList ManagedOnBehalfOfMoboBrokerResources + { + get => ManagedOnBehalfOfConfiguration?.MoboBrokerResources; + } + + /// Data connector credentials of AgriService instance. + public IList DataConnectorCredentials { get; } + /// AgriService installed solutions. + public IList InstalledSolutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..b2361d9ff7e3 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.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; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgriServiceResourceUpdateProperties : 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(AgriServiceResourceUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + writer.WriteObjectValue(Config, options); + } + if (Optional.IsCollectionDefined(DataConnectorCredentials)) + { + writer.WritePropertyName("dataConnectorCredentials"u8); + writer.WriteStartArray(); + foreach (var item in DataConnectorCredentials) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(InstalledSolutions)) + { + writer.WritePropertyName("installedSolutions"u8); + writer.WriteStartArray(); + foreach (var item in InstalledSolutions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriServiceResourceUpdateProperties 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(AgriServiceResourceUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceUpdateProperties(document.RootElement, options); + } + + internal static AgriServiceResourceUpdateProperties DeserializeAgriServiceResourceUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgriServiceConfig config = default; + IList dataConnectorCredentials = default; + IList installedSolutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + config = AgriServiceConfig.DeserializeAgriServiceConfig(property.Value, options); + continue; + } + if (property.NameEquals("dataConnectorCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataConnectorCredentialMap.DeserializeDataConnectorCredentialMap(item, options)); + } + dataConnectorCredentials = array; + continue; + } + if (property.NameEquals("installedSolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InstalledSolutionMap.DeserializeInstalledSolutionMap(item, options)); + } + installedSolutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriServiceResourceUpdateProperties(config, dataConnectorCredentials ?? new ChangeTrackingList(), installedSolutions ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgriServiceResourceUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriServiceResourceUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs new file mode 100644 index 000000000000..e92065a9e3fb --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The updatable properties of the AgriServiceResource. + public partial class AgriServiceResourceUpdateProperties + { + /// + /// 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 AgriServiceResourceUpdateProperties() + { + DataConnectorCredentials = new ChangeTrackingList(); + InstalledSolutions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Config of the AgriService instance. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceUpdateProperties(AgriServiceConfig config, IList dataConnectorCredentials, IList installedSolutions, IDictionary serializedAdditionalRawData) + { + Config = config; + DataConnectorCredentials = dataConnectorCredentials; + InstalledSolutions = installedSolutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Config of the AgriService instance. + public AgriServiceConfig Config { get; set; } + /// Data connector credentials of AgriService instance. + public IList DataConnectorCredentials { get; } + /// AgriService installed solutions. + public IList InstalledSolutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs new file mode 100644 index 000000000000..ccc4205799e8 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs @@ -0,0 +1,184 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgriculturePlatformSku : 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(AgriculturePlatformSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier.Value.ToSerialString()); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(Family)) + { + writer.WritePropertyName("family"u8); + writer.WriteStringValue(Family); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriculturePlatformSku 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(AgriculturePlatformSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriculturePlatformSku(document.RootElement, options); + } + + internal static AgriculturePlatformSku DeserializeAgriculturePlatformSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + AgriculturePlatformSkuTier? tier = default; + string size = default; + string family = default; + int? capacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = property.Value.GetString().ToAgriculturePlatformSkuTier(); + continue; + } + if (property.NameEquals("size"u8)) + { + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("family"u8)) + { + family = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriculturePlatformSku( + name, + tier, + size, + family, + capacity, + 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(AgriculturePlatformSku)} does not support writing '{options.Format}' format."); + } + } + + AgriculturePlatformSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAgriculturePlatformSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriculturePlatformSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs new file mode 100644 index 000000000000..2d3161a91e82 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The resource model definition representing SKU. + public partial class AgriculturePlatformSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + /// is null. + public AgriculturePlatformSku(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + /// If the service has different generations of hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + /// Keeps track of any properties unknown to the library. + internal AgriculturePlatformSku(string name, AgriculturePlatformSkuTier? tier, string size, string family, int? capacity, IDictionary serializedAdditionalRawData) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgriculturePlatformSku() + { + } + + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + public string Name { get; set; } + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + public AgriculturePlatformSkuTier? Tier { get; set; } + /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + public string Size { get; set; } + /// If the service has different generations of hardware, for the same SKU, then that can be captured here. + public string Family { get; set; } + /// If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + public int? Capacity { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs new file mode 100644 index 000000000000..69b2f10d444d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + internal static partial class AgriculturePlatformSkuTierExtensions + { + public static string ToSerialString(this AgriculturePlatformSkuTier value) => value switch + { + AgriculturePlatformSkuTier.Free => "Free", + AgriculturePlatformSkuTier.Basic => "Basic", + AgriculturePlatformSkuTier.Standard => "Standard", + AgriculturePlatformSkuTier.Premium => "Premium", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AgriculturePlatformSkuTier value.") + }; + + public static AgriculturePlatformSkuTier ToAgriculturePlatformSkuTier(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Free")) return AgriculturePlatformSkuTier.Free; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Basic")) return AgriculturePlatformSkuTier.Basic; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Standard")) return AgriculturePlatformSkuTier.Standard; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Premium")) return AgriculturePlatformSkuTier.Premium; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AgriculturePlatformSkuTier value."); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs new file mode 100644 index 000000000000..003792193cf8 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + public enum AgriculturePlatformSkuTier + { + /// The Free service tier. + Free, + /// The Basic service tier. + Basic, + /// The Standard service tier. + Standard, + /// The Premium service tier. + Premium + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.cs new file mode 100644 index 000000000000..b7984bad0c37 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.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.AgriculturePlatform.Models +{ + /// Types of different kind of Data connector auth credentials supported. + public readonly partial struct AuthCredentialsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthCredentialsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OAuthClientCredentialsValue = "OAuthClientCredentials"; + private const string ApiKeyAuthCredentialsValue = "ApiKeyAuthCredentials"; + + /// OAuth Client Credential type. + public static AuthCredentialsKind OAuthClientCredentials { get; } = new AuthCredentialsKind(OAuthClientCredentialsValue); + /// API Key Auth Credential type. + public static AuthCredentialsKind ApiKeyAuthCredentials { get; } = new AuthCredentialsKind(ApiKeyAuthCredentialsValue); + /// Determines if two values are the same. + public static bool operator ==(AuthCredentialsKind left, AuthCredentialsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthCredentialsKind left, AuthCredentialsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthCredentialsKind(string value) => new AuthCredentialsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthCredentialsKind other && Equals(other); + /// + public bool Equals(AuthCredentialsKind 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs new file mode 100644 index 000000000000..f1f4b8462484 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AvailableAgriSolutionListResult : 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(AvailableAgriSolutionListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("solutions"u8); + writer.WriteStartArray(); + foreach (var item in Solutions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AvailableAgriSolutionListResult 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(AvailableAgriSolutionListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableAgriSolutionListResult(document.RootElement, options); + } + + internal static AvailableAgriSolutionListResult DeserializeAvailableAgriSolutionListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList solutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutions"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataManagerForAgricultureSolution.DeserializeDataManagerForAgricultureSolution(item, options)); + } + solutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AvailableAgriSolutionListResult(solutions, 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(AvailableAgriSolutionListResult)} does not support writing '{options.Format}' format."); + } + } + + AvailableAgriSolutionListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAvailableAgriSolutionListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AvailableAgriSolutionListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs new file mode 100644 index 000000000000..1952a13cd701 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The list of available agri solutions. + public partial class AvailableAgriSolutionListResult + { + /// + /// 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 . + /// Agri solutions list. + /// is null. + internal AvailableAgriSolutionListResult(IEnumerable solutions) + { + Argument.AssertNotNull(solutions, nameof(solutions)); + + Solutions = solutions.ToList(); + } + + /// Initializes a new instance of . + /// Agri solutions list. + /// Keeps track of any properties unknown to the library. + internal AvailableAgriSolutionListResult(IReadOnlyList solutions, IDictionary serializedAdditionalRawData) + { + Solutions = solutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailableAgriSolutionListResult() + { + } + + /// Agri solutions list. + public IReadOnlyList Solutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs new file mode 100644 index 000000000000..2f376ca2fe6e --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class DataConnectorCredentialMap : 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(DataConnectorCredentialMap)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(Value, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataConnectorCredentialMap 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(DataConnectorCredentialMap)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataConnectorCredentialMap(document.RootElement, options); + } + + internal static DataConnectorCredentialMap DeserializeDataConnectorCredentialMap(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + DataConnectorCredentials value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = DataConnectorCredentials.DeserializeDataConnectorCredentials(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataConnectorCredentialMap(key, value, 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(DataConnectorCredentialMap)} does not support writing '{options.Format}' format."); + } + } + + DataConnectorCredentialMap IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataConnectorCredentialMap(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataConnectorCredentialMap)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs new file mode 100644 index 000000000000..7ae5b121f387 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Mapping of data connector credentials. + public partial class DataConnectorCredentialMap + { + /// + /// 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 key representing the credential. + /// The data connector credential value. + /// or is null. + public DataConnectorCredentialMap(string key, DataConnectorCredentials value) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + Key = key; + Value = value; + } + + /// Initializes a new instance of . + /// The key representing the credential. + /// The data connector credential value. + /// Keeps track of any properties unknown to the library. + internal DataConnectorCredentialMap(string key, DataConnectorCredentials value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataConnectorCredentialMap() + { + } + + /// The key representing the credential. + public string Key { get; set; } + /// The data connector credential value. + public DataConnectorCredentials Value { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs new file mode 100644 index 000000000000..97aba179b648 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.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; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class DataConnectorCredentials : 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(DataConnectorCredentials)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(KeyVaultUri)) + { + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri); + } + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVersion)) + { + writer.WritePropertyName("keyVersion"u8); + writer.WriteStringValue(KeyVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataConnectorCredentials 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(DataConnectorCredentials)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataConnectorCredentials(document.RootElement, options); + } + + internal static DataConnectorCredentials DeserializeDataConnectorCredentials(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AuthCredentialsKind? kind = default; + string clientId = default; + string keyVaultUri = default; + string keyName = default; + string keyVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new AuthCredentialsKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVaultUri"u8)) + { + keyVaultUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyName"u8)) + { + keyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVersion"u8)) + { + keyVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataConnectorCredentials( + kind, + clientId, + keyVaultUri, + keyName, + keyVersion, + 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(DataConnectorCredentials)} does not support writing '{options.Format}' format."); + } + } + + DataConnectorCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataConnectorCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataConnectorCredentials)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs new file mode 100644 index 000000000000..7ec398320298 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The properties related to an AgriService data connector. + public partial class DataConnectorCredentials + { + /// + /// 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 DataConnectorCredentials() + { + } + + /// Initializes a new instance of . + /// Type of credential. + /// Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + /// Uri of the key vault. + /// Name of the key vault key. + /// Version of the key vault key. + /// Keeps track of any properties unknown to the library. + internal DataConnectorCredentials(AuthCredentialsKind? kind, string clientId, string keyVaultUri, string keyName, string keyVersion, IDictionary serializedAdditionalRawData) + { + Kind = kind; + ClientId = clientId; + KeyVaultUri = keyVaultUri; + KeyName = keyName; + KeyVersion = keyVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of credential. + public AuthCredentialsKind? Kind { get; set; } + /// Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + public string ClientId { get; set; } + /// Uri of the key vault. + public string KeyVaultUri { get; set; } + /// Name of the key vault key. + public string KeyName { get; set; } + /// Version of the key vault key. + public string KeyVersion { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs new file mode 100644 index 000000000000..c8f880fc20a4 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs @@ -0,0 +1,210 @@ +// 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.AgriculturePlatform.Models +{ + public partial class DataManagerForAgricultureSolution : 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(DataManagerForAgricultureSolution)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("partnerId"u8); + writer.WriteStringValue(PartnerId); + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + writer.WritePropertyName("partnerTenantId"u8); + writer.WriteStringValue(PartnerTenantId); + writer.WritePropertyName("dataAccessScopes"u8); + writer.WriteStartArray(); + foreach (var item in DataAccessScopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("marketPlaceOfferDetails"u8); + writer.WriteObjectValue(MarketPlaceOfferDetails, options); + writer.WritePropertyName("saasApplicationId"u8); + writer.WriteStringValue(SaasApplicationId); + writer.WritePropertyName("accessAzureDataManagerForAgricultureApplicationId"u8); + writer.WriteStringValue(AccessAzureDataManagerForAgricultureApplicationId); + writer.WritePropertyName("accessAzureDataManagerForAgricultureApplicationName"u8); + writer.WriteStringValue(AccessAzureDataManagerForAgricultureApplicationName); + writer.WritePropertyName("isValidateInput"u8); + writer.WriteBooleanValue(IsValidateInput); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataManagerForAgricultureSolution 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(DataManagerForAgricultureSolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataManagerForAgricultureSolution(document.RootElement, options); + } + + internal static DataManagerForAgricultureSolution DeserializeDataManagerForAgricultureSolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string partnerId = default; + string solutionId = default; + string partnerTenantId = default; + IReadOnlyList dataAccessScopes = default; + MarketPlaceOfferDetails marketPlaceOfferDetails = default; + string saasApplicationId = default; + string accessAzureDataManagerForAgricultureApplicationId = default; + string accessAzureDataManagerForAgricultureApplicationName = default; + bool isValidateInput = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("partnerId"u8)) + { + partnerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("partnerTenantId"u8)) + { + partnerTenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataAccessScopes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dataAccessScopes = array; + continue; + } + if (property.NameEquals("marketPlaceOfferDetails"u8)) + { + marketPlaceOfferDetails = MarketPlaceOfferDetails.DeserializeMarketPlaceOfferDetails(property.Value, options); + continue; + } + if (property.NameEquals("saasApplicationId"u8)) + { + saasApplicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessAzureDataManagerForAgricultureApplicationId"u8)) + { + accessAzureDataManagerForAgricultureApplicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessAzureDataManagerForAgricultureApplicationName"u8)) + { + accessAzureDataManagerForAgricultureApplicationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("isValidateInput"u8)) + { + isValidateInput = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataManagerForAgricultureSolution( + partnerId, + solutionId, + partnerTenantId, + dataAccessScopes, + marketPlaceOfferDetails, + saasApplicationId, + accessAzureDataManagerForAgricultureApplicationId, + accessAzureDataManagerForAgricultureApplicationName, + isValidateInput, + 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(DataManagerForAgricultureSolution)} does not support writing '{options.Format}' format."); + } + } + + DataManagerForAgricultureSolution IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataManagerForAgricultureSolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataManagerForAgricultureSolution)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs new file mode 100644 index 000000000000..ee2b9d521dcf --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs @@ -0,0 +1,131 @@ +// 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.AgriculturePlatform.Models +{ + /// Data Manager for Agriculture solution. + public partial class DataManagerForAgricultureSolution + { + /// + /// 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 . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// , , , , , , or is null. + internal DataManagerForAgricultureSolution(string partnerId, string solutionId, string partnerTenantId, IEnumerable dataAccessScopes, MarketPlaceOfferDetails marketPlaceOfferDetails, string saasApplicationId, string accessAzureDataManagerForAgricultureApplicationId, string accessAzureDataManagerForAgricultureApplicationName, bool isValidateInput) + { + Argument.AssertNotNull(partnerId, nameof(partnerId)); + Argument.AssertNotNull(solutionId, nameof(solutionId)); + Argument.AssertNotNull(partnerTenantId, nameof(partnerTenantId)); + Argument.AssertNotNull(dataAccessScopes, nameof(dataAccessScopes)); + Argument.AssertNotNull(marketPlaceOfferDetails, nameof(marketPlaceOfferDetails)); + Argument.AssertNotNull(saasApplicationId, nameof(saasApplicationId)); + Argument.AssertNotNull(accessAzureDataManagerForAgricultureApplicationId, nameof(accessAzureDataManagerForAgricultureApplicationId)); + Argument.AssertNotNull(accessAzureDataManagerForAgricultureApplicationName, nameof(accessAzureDataManagerForAgricultureApplicationName)); + + PartnerId = partnerId; + SolutionId = solutionId; + PartnerTenantId = partnerTenantId; + DataAccessScopes = dataAccessScopes.ToList(); + MarketPlaceOfferDetails = marketPlaceOfferDetails; + SaasApplicationId = saasApplicationId; + AccessAzureDataManagerForAgricultureApplicationId = accessAzureDataManagerForAgricultureApplicationId; + AccessAzureDataManagerForAgricultureApplicationName = accessAzureDataManagerForAgricultureApplicationName; + IsValidateInput = isValidateInput; + } + + /// Initializes a new instance of . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// Keeps track of any properties unknown to the library. + internal DataManagerForAgricultureSolution(string partnerId, string solutionId, string partnerTenantId, IReadOnlyList dataAccessScopes, MarketPlaceOfferDetails marketPlaceOfferDetails, string saasApplicationId, string accessAzureDataManagerForAgricultureApplicationId, string accessAzureDataManagerForAgricultureApplicationName, bool isValidateInput, IDictionary serializedAdditionalRawData) + { + PartnerId = partnerId; + SolutionId = solutionId; + PartnerTenantId = partnerTenantId; + DataAccessScopes = dataAccessScopes; + MarketPlaceOfferDetails = marketPlaceOfferDetails; + SaasApplicationId = saasApplicationId; + AccessAzureDataManagerForAgricultureApplicationId = accessAzureDataManagerForAgricultureApplicationId; + AccessAzureDataManagerForAgricultureApplicationName = accessAzureDataManagerForAgricultureApplicationName; + IsValidateInput = isValidateInput; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataManagerForAgricultureSolution() + { + } + + /// Partner Id. + public string PartnerId { get; } + /// Solution Id. + public string SolutionId { get; } + /// Partner tenant Id. + public string PartnerTenantId { get; } + /// Data access scopes. + public IReadOnlyList DataAccessScopes { get; } + /// Marketplace offer details. + public MarketPlaceOfferDetails MarketPlaceOfferDetails { get; } + /// Saas application Id. + public string SaasApplicationId { get; } + /// Entra application Id used to access azure data manager for agriculture instance. + public string AccessAzureDataManagerForAgricultureApplicationId { get; } + /// Entra application name used to access azure data manager for agriculture instance. + public string AccessAzureDataManagerForAgricultureApplicationName { get; } + /// Whether solution inference will validate input. + public bool IsValidateInput { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs new file mode 100644 index 000000000000..8083746cf915 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class InstalledSolutionMap : 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(InstalledSolutionMap)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(Value, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InstalledSolutionMap 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(InstalledSolutionMap)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstalledSolutionMap(document.RootElement, options); + } + + internal static InstalledSolutionMap DeserializeInstalledSolutionMap(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + Solution value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = Solution.DeserializeSolution(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstalledSolutionMap(key, value, 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(InstalledSolutionMap)} does not support writing '{options.Format}' format."); + } + } + + InstalledSolutionMap IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInstalledSolutionMap(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstalledSolutionMap)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs new file mode 100644 index 000000000000..bee5115cf2fd --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Mapping of installed solutions. + public partial class InstalledSolutionMap + { + /// + /// 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 key representing the installed solution. + /// The installed solution value. + /// or is null. + public InstalledSolutionMap(string key, Solution value) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + Key = key; + Value = value; + } + + /// Initializes a new instance of . + /// The key representing the installed solution. + /// The installed solution value. + /// Keeps track of any properties unknown to the library. + internal InstalledSolutionMap(string key, Solution value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstalledSolutionMap() + { + } + + /// The key representing the installed solution. + public string Key { get; set; } + /// The installed solution value. + public Solution Value { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs new file mode 100644 index 000000000000..b7db0746cd61 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + internal partial class ManagedOnBehalfOfConfiguration : 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(ManagedOnBehalfOfConfiguration)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("moboBrokerResources"u8); + writer.WriteStartArray(); + foreach (var item in MoboBrokerResources) + { + JsonSerializer.Serialize(writer, item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ManagedOnBehalfOfConfiguration 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(ManagedOnBehalfOfConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOnBehalfOfConfiguration(document.RootElement, options); + } + + internal static ManagedOnBehalfOfConfiguration DeserializeManagedOnBehalfOfConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList moboBrokerResources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("moboBrokerResources"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + moboBrokerResources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOnBehalfOfConfiguration(moboBrokerResources, 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(ManagedOnBehalfOfConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ManagedOnBehalfOfConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeManagedOnBehalfOfConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOnBehalfOfConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs new file mode 100644 index 000000000000..bae2f95bef45 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.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 System.Linq; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Configuration of the managed on behalf of resource. + internal partial class ManagedOnBehalfOfConfiguration + { + /// + /// 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 . + /// Associated MoboBrokerResources. + internal ManagedOnBehalfOfConfiguration(IEnumerable moboBrokerResources) + { + MoboBrokerResources = moboBrokerResources.ToList(); + } + + /// Initializes a new instance of . + /// Associated MoboBrokerResources. + /// Keeps track of any properties unknown to the library. + internal ManagedOnBehalfOfConfiguration(IReadOnlyList moboBrokerResources, IDictionary serializedAdditionalRawData) + { + MoboBrokerResources = moboBrokerResources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedOnBehalfOfConfiguration() + { + } + + /// Associated MoboBrokerResources. + public IReadOnlyList MoboBrokerResources { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs new file mode 100644 index 000000000000..04e228ef4df8 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class MarketPlaceOfferDetails : 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(MarketPlaceOfferDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("saasOfferId"u8); + writer.WriteStringValue(SaasOfferId); + writer.WritePropertyName("publisherId"u8); + writer.WriteStringValue(PublisherId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + MarketPlaceOfferDetails 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(MarketPlaceOfferDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketPlaceOfferDetails(document.RootElement, options); + } + + internal static MarketPlaceOfferDetails DeserializeMarketPlaceOfferDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string saasOfferId = default; + string publisherId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("saasOfferId"u8)) + { + saasOfferId = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketPlaceOfferDetails(saasOfferId, publisherId, 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(MarketPlaceOfferDetails)} does not support writing '{options.Format}' format."); + } + } + + MarketPlaceOfferDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeMarketPlaceOfferDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketPlaceOfferDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs new file mode 100644 index 000000000000..73a83366055e --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Marketplace offer details of Agri solution. + public partial class MarketPlaceOfferDetails + { + /// + /// 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 . + /// Saas offer Id. + /// Publisher Id. + /// or is null. + internal MarketPlaceOfferDetails(string saasOfferId, string publisherId) + { + Argument.AssertNotNull(saasOfferId, nameof(saasOfferId)); + Argument.AssertNotNull(publisherId, nameof(publisherId)); + + SaasOfferId = saasOfferId; + PublisherId = publisherId; + } + + /// Initializes a new instance of . + /// Saas offer Id. + /// Publisher Id. + /// Keeps track of any properties unknown to the library. + internal MarketPlaceOfferDetails(string saasOfferId, string publisherId, IDictionary serializedAdditionalRawData) + { + SaasOfferId = saasOfferId; + PublisherId = publisherId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MarketPlaceOfferDetails() + { + } + + /// Saas offer Id. + public string SaasOfferId { get; } + /// Publisher Id. + public string PublisherId { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ProvisioningState.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..43d491e36cb2 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The status of the current operation. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// The resource is being provisioned. + public static ProvisioningState Provisioning { get; } = new ProvisioningState(ProvisioningValue); + /// The resource is updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// The resource is being deleted. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// The resource create request has been accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.Serialization.cs new file mode 100644 index 000000000000..8701f7f2667c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.Serialization.cs @@ -0,0 +1,191 @@ +// 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.AgriculturePlatform.Models +{ + public partial class Solution : 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(Solution)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ApplicationName)) + { + writer.WritePropertyName("applicationName"u8); + writer.WriteStringValue(ApplicationName); + } + if (Optional.IsDefined(PartnerId)) + { + writer.WritePropertyName("partnerId"u8); + writer.WriteStringValue(PartnerId); + } + if (Optional.IsDefined(MarketPlacePublisherId)) + { + writer.WritePropertyName("marketPlacePublisherId"u8); + writer.WriteStringValue(MarketPlacePublisherId); + } + if (Optional.IsDefined(SaasSubscriptionId)) + { + writer.WritePropertyName("saasSubscriptionId"u8); + writer.WriteStringValue(SaasSubscriptionId); + } + if (Optional.IsDefined(SaasSubscriptionName)) + { + writer.WritePropertyName("saasSubscriptionName"u8); + writer.WriteStringValue(SaasSubscriptionName); + } + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Solution 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(Solution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSolution(document.RootElement, options); + } + + internal static Solution DeserializeSolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string applicationName = default; + string partnerId = default; + string marketPlacePublisherId = default; + string saasSubscriptionId = default; + string saasSubscriptionName = default; + string planId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationName"u8)) + { + applicationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("partnerId"u8)) + { + partnerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("marketPlacePublisherId"u8)) + { + marketPlacePublisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("saasSubscriptionId"u8)) + { + saasSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("saasSubscriptionName"u8)) + { + saasSubscriptionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Solution( + applicationName, + partnerId, + marketPlacePublisherId, + saasSubscriptionId, + saasSubscriptionName, + planId, + 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(Solution)} does not support writing '{options.Format}' format."); + } + } + + Solution IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Solution)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.cs new file mode 100644 index 000000000000..854241ecedc5 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/Solution.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Installed data manager for Agriculture solution detail. + public partial class Solution + { + /// + /// 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 Solution() + { + } + + /// Initializes a new instance of . + /// Application name of the solution. + /// Partner Id. + /// Marketplace publisher Id. + /// Saas subscription Id. + /// Saas subscription name. + /// Plan Id. + /// Keeps track of any properties unknown to the library. + internal Solution(string applicationName, string partnerId, string marketPlacePublisherId, string saasSubscriptionId, string saasSubscriptionName, string planId, IDictionary serializedAdditionalRawData) + { + ApplicationName = applicationName; + PartnerId = partnerId; + MarketPlacePublisherId = marketPlacePublisherId; + SaasSubscriptionId = saasSubscriptionId; + SaasSubscriptionName = saasSubscriptionName; + PlanId = planId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Application name of the solution. + public string ApplicationName { get; set; } + /// Partner Id. + public string PartnerId { get; set; } + /// Marketplace publisher Id. + public string MarketPlacePublisherId { get; set; } + /// Saas subscription Id. + public string SaasSubscriptionId { get; set; } + /// Saas subscription name. + public string SaasSubscriptionName { get; set; } + /// Plan Id. + public string PlanId { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ProviderConstants.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..9fb5a17db4ac --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs new file mode 100644 index 000000000000..6c4559b83544 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs @@ -0,0 +1,817 @@ +// 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.AgriculturePlatform.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + internal partial class AgriServiceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AgriServiceRestOperations. + /// 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 AgriServiceRestOperations(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 ?? "2024-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AgriServiceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceData.DeserializeAgriServiceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AgriServiceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AgriServiceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AgriServiceResourceData.DeserializeAgriServiceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AgriServiceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgriServiceResourceData 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgriServiceResourceData 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, 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 AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 agriServiceResourceName, AgriServiceResourcePatch 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgriServiceResourcePatch 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, 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 AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgriServiceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + 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 AgriServiceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _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.AgriculturePlatform/agriServices", 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.AgriculturePlatform/agriServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(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.AgriculturePlatform/agriServices", 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.AgriculturePlatform/agriServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAvailableSolutionsRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendPath("/listAvailableSolutions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListAvailableSolutionsRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendPath("/listAvailableSolutions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the list of available agri solutions. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAvailableSolutionsAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateListAvailableSolutionsRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailableAgriSolutionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailableAgriSolutionListResult.DeserializeAvailableAgriSolutionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the list of available agri solutions. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListAvailableSolutions(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateListAvailableSolutionsRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailableAgriSolutionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailableAgriSolutionListResult.DeserializeAvailableAgriSolutionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(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 AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Properties/AssemblyInfo.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..04cdc3b4b17d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform.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("AgriculturePlatform")] diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.cs new file mode 100644 index 000000000000..dc2cbcb6ecaa --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.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.AgriculturePlatform.Tests +{ + public class AgriculturePlatformManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected AgriculturePlatformManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected AgriculturePlatformManagementTestBase(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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs new file mode 100644 index 000000000000..c74db678b879 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.AgriculturePlatform.Tests +{ + public class AgriculturePlatformManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj new file mode 100644 index 000000000000..b2f75d13a0cf --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml new file mode 100644 index 000000000000..912d2911d282 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/agricultureplatform/AgriculturePlatform.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/agricultureplatform/ci.mgmt.yml b/sdk/agricultureplatform/ci.mgmt.yml new file mode 100644 index 000000000000..3b4a49c9c108 --- /dev/null +++ b/sdk/agricultureplatform/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/agricultureplatform /ci.mgmt.yml + - sdk/agricultureplatform /Azure.ResourceManager.AgriculturePlatform / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: agricultureplatform + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.AgriculturePlatform + safeName: AzureResourceManagerAgriculturePlatform diff --git a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/autorest.md b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/autorest.md index a72a5d12bd76..58fc68f15481 100644 --- a/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/autorest.md +++ b/sdk/appcomplianceautomation/Azure.ResourceManager.AppComplianceAutomation/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: AppComplianceAutomation namespace: Azure.ResourceManager.AppComplianceAutomation -require: https://github.com/Azure/azure-rest-api-specs/blob/f28f14c35918513bd3c3cf9f30d31ee192602525/specification/appcomplianceautomation/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/appcomplianceautomation/resource-manager/readme.md #tag: package-2024-06 output-folder: $(this-folder)/Generated clear-output-folder: true 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..600b1aa1b45a --- /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 AlertRuleResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AlertRuleResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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.AlertRuleResourceData 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.AlertRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AlertRuleResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AlertRuleResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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 AlertRuleResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AlertRuleResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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.ResourceManager.DatabaseWatcher.AlertRuleResource GetAlertRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.HealthValidationResource GetHealthValidationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResource GetSharedPrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.TargetResource GetTargetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWatcher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWatcherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherResource GetWatcherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherCollection GetWatchers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetWatchers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetWatchersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class HealthValidationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected HealthValidationCollection() { } + 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 HealthValidationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthValidationData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.HealthValidationData 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.HealthValidationData 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 HealthValidationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected HealthValidationResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationData 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.HealthValidationData 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.HealthValidationData 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 SharedPrivateLinkResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SharedPrivateLinkResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SharedPrivateLinkResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SharedPrivateLinkResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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 SharedPrivateLinkResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SharedPrivateLinkResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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 TargetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TargetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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 TargetData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TargetData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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 TargetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TargetResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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.TargetData 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.TargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.TargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WatcherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WatcherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.WatcherData 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.WatcherData 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 WatcherData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.WatcherData 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.WatcherData 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 WatcherResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WatcherResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherData 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 Azure.Response GetAlertRuleResource(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAlertRuleResourceAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceCollection GetAlertRuleResources() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetHealthValidation(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthValidationAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationCollection GetHealthValidations() { throw null; } + public virtual Azure.Response GetSharedPrivateLinkResource(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceCollection GetSharedPrivateLinkResources() { throw null; } + public virtual Azure.Response GetTarget(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTargetAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetCollection GetTargets() { 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.WatcherData 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.WatcherData 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.WatcherPatch 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.WatcherPatch patch, 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.AlertRuleResource GetAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationResource GetHealthValidationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResource GetSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetResource GetTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherResource GetWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDatabaseWatcherResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherResourceGroupResource() { } + public virtual Azure.Response GetWatcher(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWatcherAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherCollection GetWatchers() { throw null; } + } + public partial class MockableDatabaseWatcherSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherSubscriptionResource() { } + public virtual Azure.Pageable GetWatchers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWatchersAsync(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 partial class AlertRuleResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AlertRuleResourceProperties(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.ResourceProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties 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.AlertRuleResourceProperties 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 ArmDatabaseWatcherModelFactory + { + public static Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData AlertRuleResourceData(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.AlertRuleResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties AlertRuleResourceProperties(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.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.HealthValidationData HealthValidationData(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.HealthValidationProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties HealthValidationProperties(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus status = default(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus), System.Collections.Generic.IEnumerable issues = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { 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.SharedPrivateLinkResourceData SharedPrivateLinkResourceData(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.SharedPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties SharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus?), Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlMiResourceId = null, int? connectionTcpPort = default(int?), bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.TargetData TargetData(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.TargetProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties TargetProperties(string targetType = null, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationIssue ValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, System.Uri recommendationUri = null, Azure.Core.ResourceIdentifier relatedResourceId = null, string relatedResourceType = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherData WatcherData(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.WatcherProperties properties = null, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 identity = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties WatcherProperties(Azure.ResourceManager.DatabaseWatcher.Models.Datastore datastore = null, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState?), Azure.Core.ResourceIdentifier defaultAlertRuleIdentityResourceId = null) { 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; } + } + public partial class Datastore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Datastore(string kustoClusterUri, string kustoDataIngestionUri, string kustoDatabaseName, string kustoManagementUri, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType kustoOfferingType) { } + public Azure.Core.ResourceIdentifier AdxClusterResourceId { get { throw null; } set { } } + public string KustoClusterDisplayName { get { throw null; } set { } } + public string KustoClusterUri { get { throw null; } set { } } + public string KustoDatabaseName { get { throw null; } set { } } + public string KustoDataIngestionUri { get { throw null; } set { } } + public string 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.Datastore 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.Datastore 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 HealthValidationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthValidationProperties() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Issues { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties 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.HealthValidationProperties 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; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState 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.ResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SharedPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SharedPrivateLinkResourceProperties(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.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string RequestMessage { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties 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.SharedPrivateLinkResourceProperties 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 SharedPrivateLinkResourceStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SharedPrivateLinkResourceStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Approved { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Disconnected { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Pending { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus 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.SharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SqlDbElasticPoolTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties, 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.TargetProperties, 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.TargetProperties, 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 abstract partial class TargetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected TargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName) { } + public string ConnectionServerName { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType TargetAuthenticationType { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.VaultSecret TargetVault { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties 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.TargetProperties 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 ValidationIssue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ValidationIssue() { } + 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 string RelatedResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.ValidationIssue 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.ValidationIssue 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 ValidationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ValidationStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus NotStarted { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus TimedOut { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus 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.ValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class VaultSecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public VaultSecret() { } + 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.VaultSecret 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.VaultSecret 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 WatcherPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherPatch() { } + 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.WatcherPatch 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.WatcherPatch 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 WatcherProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.Datastore 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.WatcherStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties 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.WatcherProperties 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 WatcherStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WatcherStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Deleting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Starting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Stopped { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Stopping { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus 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.WatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WatcherUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherUpdateProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.Datastore 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..600b1aa1b45a --- /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 AlertRuleResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AlertRuleResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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.AlertRuleResourceData 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.AlertRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AlertRuleResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AlertRuleResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string alertRuleResourceName, Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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 AlertRuleResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AlertRuleResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData 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.AlertRuleResourceData 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.ResourceManager.DatabaseWatcher.AlertRuleResource GetAlertRuleResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.HealthValidationResource GetHealthValidationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResource GetSharedPrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.TargetResource GetTargetResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWatcher(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWatcherAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherResource GetWatcherResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherCollection GetWatchers(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetWatchers(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetWatchersAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class HealthValidationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected HealthValidationCollection() { } + 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 HealthValidationData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthValidationData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.HealthValidationData 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.HealthValidationData 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 HealthValidationResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected HealthValidationResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationData 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.HealthValidationData 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.HealthValidationData 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 SharedPrivateLinkResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SharedPrivateLinkResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SharedPrivateLinkResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SharedPrivateLinkResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string sharedPrivateLinkResourceName, Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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 SharedPrivateLinkResourceData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SharedPrivateLinkResourceData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceData 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.SharedPrivateLinkResourceData 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 TargetCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TargetCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string targetName, Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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 TargetData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public TargetData() { } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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 TargetResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TargetResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetData 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.TargetData 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.TargetData 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.TargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.DatabaseWatcher.TargetData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WatcherCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WatcherCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string watcherName, Azure.ResourceManager.DatabaseWatcher.WatcherData 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.WatcherData 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 WatcherData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 Identity { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.WatcherData 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.WatcherData 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 WatcherResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WatcherResource() { } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherData 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 Azure.Response GetAlertRuleResource(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAlertRuleResourceAsync(string alertRuleResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceCollection GetAlertRuleResources() { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetHealthValidation(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetHealthValidationAsync(string healthValidationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationCollection GetHealthValidations() { throw null; } + public virtual Azure.Response GetSharedPrivateLinkResource(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResourceCollection GetSharedPrivateLinkResources() { throw null; } + public virtual Azure.Response GetTarget(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTargetAsync(string targetName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetCollection GetTargets() { 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.WatcherData 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.WatcherData 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.WatcherPatch 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.WatcherPatch patch, 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.AlertRuleResource GetAlertRuleResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.HealthValidationResource GetHealthValidationResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.SharedPrivateLinkResource GetSharedPrivateLinkResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.TargetResource GetTargetResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherResource GetWatcherResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableDatabaseWatcherResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherResourceGroupResource() { } + public virtual Azure.Response GetWatcher(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWatcherAsync(string watcherName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.DatabaseWatcher.WatcherCollection GetWatchers() { throw null; } + } + public partial class MockableDatabaseWatcherSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableDatabaseWatcherSubscriptionResource() { } + public virtual Azure.Pageable GetWatchers(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWatchersAsync(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 partial class AlertRuleResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AlertRuleResourceProperties(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.ResourceProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties 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.AlertRuleResourceProperties 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 ArmDatabaseWatcherModelFactory + { + public static Azure.ResourceManager.DatabaseWatcher.AlertRuleResourceData AlertRuleResourceData(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.AlertRuleResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.AlertRuleResourceProperties AlertRuleResourceProperties(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.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.HealthValidationData HealthValidationData(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.HealthValidationProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties HealthValidationProperties(System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset endOn = default(System.DateTimeOffset), Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus status = default(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus), System.Collections.Generic.IEnumerable issues = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { 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.SharedPrivateLinkResourceData SharedPrivateLinkResourceData(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.SharedPrivateLinkResourceProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties SharedPrivateLinkResourceProperties(Azure.Core.ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus?), Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), 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.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier sqlMiResourceId = null, int? connectionTcpPort = default(int?), bool? readIntent = default(bool?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.TargetData TargetData(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.TargetProperties properties = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties TargetProperties(string targetType = null, Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType = default(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType), Azure.ResourceManager.DatabaseWatcher.Models.VaultSecret targetVault = null, string connectionServerName = null, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState?)) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationIssue ValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, System.Uri recommendationUri = null, Azure.Core.ResourceIdentifier relatedResourceId = null, string relatedResourceType = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.WatcherData WatcherData(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.WatcherProperties properties = null, Azure.ResourceManager.DatabaseWatcher.Models.ManagedServiceIdentityV4 identity = null) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties WatcherProperties(Azure.ResourceManager.DatabaseWatcher.Models.Datastore datastore = null, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus? status = default(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus?), Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState? provisioningState = default(Azure.ResourceManager.DatabaseWatcher.Models.DatabaseWatcherProvisioningState?), Azure.Core.ResourceIdentifier defaultAlertRuleIdentityResourceId = null) { 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; } + } + public partial class Datastore : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Datastore(string kustoClusterUri, string kustoDataIngestionUri, string kustoDatabaseName, string kustoManagementUri, Azure.ResourceManager.DatabaseWatcher.Models.KustoOfferingType kustoOfferingType) { } + public Azure.Core.ResourceIdentifier AdxClusterResourceId { get { throw null; } set { } } + public string KustoClusterDisplayName { get { throw null; } set { } } + public string KustoClusterUri { get { throw null; } set { } } + public string KustoDatabaseName { get { throw null; } set { } } + public string KustoDataIngestionUri { get { throw null; } set { } } + public string 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.Datastore 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.Datastore 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 HealthValidationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal HealthValidationProperties() { } + public System.DateTimeOffset EndOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Issues { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.HealthValidationProperties 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.HealthValidationProperties 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; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState 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.ResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState left, Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SharedPrivateLinkResourceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SharedPrivateLinkResourceProperties(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.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string RequestMessage { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceProperties 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.SharedPrivateLinkResourceProperties 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 SharedPrivateLinkResourceStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SharedPrivateLinkResourceStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Approved { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Disconnected { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Pending { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus 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.SharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus left, Azure.ResourceManager.DatabaseWatcher.Models.SharedPrivateLinkResourceStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SqlDbElasticPoolTargetProperties : Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties, 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.TargetProperties, 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.TargetProperties, 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 abstract partial class TargetProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + protected TargetProperties(Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType targetAuthenticationType, string connectionServerName) { } + public string ConnectionServerName { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.DatabaseWatcher.Models.TargetAuthenticationType TargetAuthenticationType { get { throw null; } set { } } + public Azure.ResourceManager.DatabaseWatcher.Models.VaultSecret TargetVault { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.TargetProperties 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.TargetProperties 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 ValidationIssue : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ValidationIssue() { } + 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 string RelatedResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.ValidationIssue 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.ValidationIssue 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 ValidationStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ValidationStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Canceled { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Failed { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus NotStarted { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus Succeeded { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus TimedOut { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus 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.ValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus left, Azure.ResourceManager.DatabaseWatcher.Models.ValidationStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class VaultSecret : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public VaultSecret() { } + 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.VaultSecret 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.VaultSecret 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 WatcherPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherPatch() { } + 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.WatcherPatch 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.WatcherPatch 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 WatcherProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.Datastore 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.WatcherStatus? Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DatabaseWatcher.Models.WatcherProperties 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.WatcherProperties 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 WatcherStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public WatcherStatus(string value) { throw null; } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Deleting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Running { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Starting { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Stopped { get { throw null; } } + public static Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus Stopping { get { throw null; } } + public bool Equals(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus 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.WatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus left, Azure.ResourceManager.DatabaseWatcher.Models.WatcherStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WatcherUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WatcherUpdateProperties() { } + public Azure.ResourceManager.DatabaseWatcher.Models.Datastore 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_AlertRuleResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_AlertRuleResource.cs new file mode 100644 index 000000000000..3485ac40f5df --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_AlertRuleResource.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_AlertRuleResource + { + [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 AlertRuleResource created on azure + // for more information of creating AlertRuleResource, please refer to the document of AlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier alertRuleResourceId = AlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + AlertRuleResource alertRuleResource = client.GetAlertRuleResource(alertRuleResourceId); + + // invoke the operation + AlertRuleResource result = await alertRuleResource.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 + AlertRuleResourceData 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 AlertRuleResource created on azure + // for more information of creating AlertRuleResource, please refer to the document of AlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier alertRuleResourceId = AlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + AlertRuleResource alertRuleResource = client.GetAlertRuleResource(alertRuleResourceId); + + // invoke the operation + await alertRuleResource.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 AlertRuleResource created on azure + // for more information of creating AlertRuleResource, please refer to the document of AlertRuleResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string alertRuleResourceName = "testAlert"; + ResourceIdentifier alertRuleResourceId = AlertRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, alertRuleResourceName); + AlertRuleResource alertRuleResource = client.GetAlertRuleResource(alertRuleResourceId); + + // invoke the operation + AlertRuleResourceData data = new AlertRuleResourceData + { + Properties = new AlertRuleResourceProperties(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 alertRuleResource.UpdateAsync(WaitUntil.Completed, data); + AlertRuleResource 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 + AlertRuleResourceData 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_AlertRuleResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_AlertRuleResourceCollection.cs new file mode 100644 index 000000000000..44c4f3db380a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_AlertRuleResourceCollection.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_AlertRuleResourceCollection + { + [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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this AlertRuleResource + AlertRuleResourceCollection collection = watcher.GetAlertRuleResources(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + AlertRuleResourceData data = new AlertRuleResourceData + { + Properties = new AlertRuleResourceProperties(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); + AlertRuleResource 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 + AlertRuleResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this AlertRuleResource + AlertRuleResourceCollection collection = watcher.GetAlertRuleResources(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + AlertRuleResource 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 + AlertRuleResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this AlertRuleResource + AlertRuleResourceCollection collection = watcher.GetAlertRuleResources(); + + // invoke the operation and iterate over the result + await foreach (AlertRuleResource 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 + AlertRuleResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this AlertRuleResource + AlertRuleResourceCollection collection = watcher.GetAlertRuleResources(); + + // 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this AlertRuleResource + AlertRuleResourceCollection collection = watcher.GetAlertRuleResources(); + + // invoke the operation + string alertRuleResourceName = "testAlert"; + NullableResponse response = await collection.GetIfExistsAsync(alertRuleResourceName); + AlertRuleResource 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 + AlertRuleResourceData 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_HealthValidationCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationCollection.cs new file mode 100644 index 000000000000..d42c055011fa --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationCollection.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_HealthValidationCollection + { + [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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this HealthValidationResource + HealthValidationCollection collection = watcher.GetHealthValidations(); + + // invoke the operation + string healthValidationName = "testHealthValidation"; + HealthValidationResource 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 + HealthValidationData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this HealthValidationResource + HealthValidationCollection collection = watcher.GetHealthValidations(); + + // invoke the operation and iterate over the result + await foreach (HealthValidationResource 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 + HealthValidationData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this HealthValidationResource + HealthValidationCollection collection = watcher.GetHealthValidations(); + + // 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this HealthValidationResource + HealthValidationCollection collection = watcher.GetHealthValidations(); + + // invoke the operation + string healthValidationName = "testHealthValidation"; + NullableResponse response = await collection.GetIfExistsAsync(healthValidationName); + HealthValidationResource 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 + HealthValidationData 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_HealthValidationResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationResource.cs new file mode 100644 index 000000000000..ce9b4741820d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_HealthValidationResource.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_HealthValidationResource + { + [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 HealthValidationResource created on azure + // for more information of creating HealthValidationResource, please refer to the document of HealthValidationResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string healthValidationName = "testHealthValidation"; + ResourceIdentifier healthValidationResourceId = HealthValidationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, healthValidationName); + HealthValidationResource healthValidation = client.GetHealthValidationResource(healthValidationResourceId); + + // invoke the operation + HealthValidationResource result = await healthValidation.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 + HealthValidationData 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 HealthValidationResource created on azure + // for more information of creating HealthValidationResource, please refer to the document of HealthValidationResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + string healthValidationName = "testHealthValidation"; + ResourceIdentifier healthValidationResourceId = HealthValidationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, healthValidationName); + HealthValidationResource healthValidation = client.GetHealthValidationResource(healthValidationResourceId); + + // invoke the operation + ArmOperation lro = await healthValidation.StartValidationAsync(WaitUntil.Completed); + HealthValidationResource 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 + HealthValidationData 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_SharedPrivateLinkResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResource.cs new file mode 100644 index 000000000000..8e163d7bf921 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResource.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_SharedPrivateLinkResource + { + [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 SharedPrivateLinkResource created on azure + // for more information of creating SharedPrivateLinkResource, please refer to the document of SharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier sharedPrivateLinkResourceId = SharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + SharedPrivateLinkResource sharedPrivateLinkResource = client.GetSharedPrivateLinkResource(sharedPrivateLinkResourceId); + + // invoke the operation + SharedPrivateLinkResource result = await sharedPrivateLinkResource.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 + SharedPrivateLinkResourceData 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 SharedPrivateLinkResource created on azure + // for more information of creating SharedPrivateLinkResource, please refer to the document of SharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier sharedPrivateLinkResourceId = SharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + SharedPrivateLinkResource sharedPrivateLinkResource = client.GetSharedPrivateLinkResource(sharedPrivateLinkResourceId); + + // invoke the operation + await sharedPrivateLinkResource.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 SharedPrivateLinkResource created on azure + // for more information of creating SharedPrivateLinkResource, please refer to the document of SharedPrivateLinkResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string sharedPrivateLinkResourceName = "monitoringh22eed"; + ResourceIdentifier sharedPrivateLinkResourceId = SharedPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, sharedPrivateLinkResourceName); + SharedPrivateLinkResource sharedPrivateLinkResource = client.GetSharedPrivateLinkResource(sharedPrivateLinkResourceId); + + // invoke the operation + SharedPrivateLinkResourceData data = new SharedPrivateLinkResourceData + { + Properties = new SharedPrivateLinkResourceProperties(new ResourceIdentifier("/subscriptions/49e0fbd3-75e8-44e7-96fd-5b64d9ad818d/resourceGroups/apiTest-ddat4p/providers/Microsoft.KeyVault/vaults/kvmo3ej9ih"), "vault", "request message") + { + DnsZone = "ec3ae9d410ba", + }, + }; + ArmOperation lro = await sharedPrivateLinkResource.UpdateAsync(WaitUntil.Completed, data); + SharedPrivateLinkResource 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 + SharedPrivateLinkResourceData 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_SharedPrivateLinkResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..8ea926df43bc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_SharedPrivateLinkResourceCollection.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_SharedPrivateLinkResourceCollection + { + [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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this SharedPrivateLinkResource + SharedPrivateLinkResourceCollection collection = watcher.GetSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + SharedPrivateLinkResourceData data = new SharedPrivateLinkResourceData + { + Properties = new SharedPrivateLinkResourceProperties(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); + SharedPrivateLinkResource 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 + SharedPrivateLinkResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this SharedPrivateLinkResource + SharedPrivateLinkResourceCollection collection = watcher.GetSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + SharedPrivateLinkResource 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 + SharedPrivateLinkResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this SharedPrivateLinkResource + SharedPrivateLinkResourceCollection collection = watcher.GetSharedPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (SharedPrivateLinkResource 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 + SharedPrivateLinkResourceData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this SharedPrivateLinkResource + SharedPrivateLinkResourceCollection collection = watcher.GetSharedPrivateLinkResources(); + + // 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this SharedPrivateLinkResource + SharedPrivateLinkResourceCollection collection = watcher.GetSharedPrivateLinkResources(); + + // invoke the operation + string sharedPrivateLinkResourceName = "monitoringh22eed"; + NullableResponse response = await collection.GetIfExistsAsync(sharedPrivateLinkResourceName); + SharedPrivateLinkResource 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 + SharedPrivateLinkResourceData 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..52b5589c03f6 --- /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 GetWatchers_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 (WatcherResource item in subscriptionResource.GetWatchersAsync()) + { + // 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 + WatcherData 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/samples/Generated/Samples/Sample_TargetCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetCollection.cs new file mode 100644 index 000000000000..7a680ae22dbe --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetCollection.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_TargetCollection + { + [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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this TargetResource + TargetCollection collection = watcher.GetTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + TargetData data = new TargetData + { + 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); + TargetResource 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 + TargetData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this TargetResource + TargetCollection collection = watcher.GetTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + TargetResource 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 + TargetData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this TargetResource + TargetCollection collection = watcher.GetTargets(); + + // invoke the operation and iterate over the result + await foreach (TargetResource 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 + TargetData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this TargetResource + TargetCollection collection = watcher.GetTargets(); + + // 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // get the collection of this TargetResource + TargetCollection collection = watcher.GetTargets(); + + // invoke the operation + string targetName = "monitoringh22eed"; + NullableResponse response = await collection.GetIfExistsAsync(targetName); + TargetResource 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 + TargetData 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_TargetResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetResource.cs new file mode 100644 index 000000000000..6c10469af52d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_TargetResource.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_TargetResource + { + [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 TargetResource created on azure + // for more information of creating TargetResource, please refer to the document of TargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier targetResourceId = TargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + TargetResource target = client.GetTargetResource(targetResourceId); + + // invoke the operation + TargetResource result = await target.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 + TargetData 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 TargetResource created on azure + // for more information of creating TargetResource, please refer to the document of TargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier targetResourceId = TargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + TargetResource target = client.GetTargetResource(targetResourceId); + + // invoke the operation + await target.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 TargetResource created on azure + // for more information of creating TargetResource, please refer to the document of TargetResource + string subscriptionId = "49e0fbd3-75e8-44e7-96fd-5b64d9ad818d"; + string resourceGroupName = "apiTest-ddat4p"; + string watcherName = "databasemo3ej9ih"; + string targetName = "monitoringh22eed"; + ResourceIdentifier targetResourceId = TargetResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName, targetName); + TargetResource target = client.GetTargetResource(targetResourceId); + + // invoke the operation + TargetData data = new TargetData + { + 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 target.UpdateAsync(WaitUntil.Completed, data); + TargetResource 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 + TargetData 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_WatcherCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherCollection.cs new file mode 100644 index 000000000000..840349b9b52c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherCollection.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_WatcherCollection + { + [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 WatcherResource + WatcherCollection collection = resourceGroupResource.GetWatchers(); + + // invoke the operation + string watcherName = "testWatcher"; + WatcherData data = new WatcherData(new AzureLocation("eastus2")) + { + Properties = new WatcherProperties + { + Datastore = new Datastore("https://kustouri-adx.eastus.kusto.windows.net", "https://ingest-kustouri-adx.eastus.kusto.windows.net", "kustoDatabaseName1", "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); + WatcherResource 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 + WatcherData 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 WatcherResource + WatcherCollection collection = resourceGroupResource.GetWatchers(); + + // invoke the operation + string watcherName = "myWatcher"; + WatcherResource 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 + WatcherData 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 WatcherResource + WatcherCollection collection = resourceGroupResource.GetWatchers(); + + // invoke the operation and iterate over the result + await foreach (WatcherResource 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 + WatcherData 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 WatcherResource + WatcherCollection collection = resourceGroupResource.GetWatchers(); + + // 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 WatcherResource + WatcherCollection collection = resourceGroupResource.GetWatchers(); + + // invoke the operation + string watcherName = "myWatcher"; + NullableResponse response = await collection.GetIfExistsAsync(watcherName); + WatcherResource 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 + WatcherData 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_WatcherResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherResource.cs new file mode 100644 index 000000000000..db6444b0f51d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/samples/Generated/Samples/Sample_WatcherResource.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_WatcherResource + { + [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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "myWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // invoke the operation + WatcherResource result = await watcher.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 + WatcherData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // invoke the operation + await watcher.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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // invoke the operation + WatcherPatch patch = new WatcherPatch + { + Identity = new ManagedServiceIdentityV4(ManagedServiceIdentityType.SystemAssigned), + Tags = { }, + Properties = new WatcherUpdateProperties + { + Datastore = new Datastore("https://kustouri-adx.eastus.kusto.windows.net", "https://ingest-kustouri-adx.eastus.kusto.windows.net", "kustoDatabaseName1", "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 watcher.UpdateAsync(WaitUntil.Completed, patch); + WatcherResource 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 + WatcherData 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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "testWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // invoke the operation + await watcher.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 WatcherResource created on azure + // for more information of creating WatcherResource, please refer to the document of WatcherResource + string subscriptionId = "A76F9850-996B-40B3-94D4-C98110A0EEC9"; + string resourceGroupName = "rgWatcher"; + string watcherName = "myWatcher"; + ResourceIdentifier watcherResourceId = WatcherResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, watcherName); + WatcherResource watcher = client.GetWatcherResource(watcherResourceId); + + // invoke the operation + await watcher.StopAsync(WaitUntil.Completed); + + 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/AlertRuleResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.Serialization.cs new file mode 100644 index 000000000000..f6ae198f9d4c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.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 AlertRuleResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AlertRuleResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AlertRuleResourceData 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/AlertRuleResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.cs new file mode 100644 index 000000000000..fd418580c368 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResource.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 an AlertRuleResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAlertRuleResource method. + /// Otherwise you can get one from its parent resource using the GetAlertRuleResource method. + /// + public partial class AlertRuleResource : 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 _alertRuleResourceClientDiagnostics; + private readonly AlertRuleResourcesRestOperations _alertRuleResourceRestClient; + private readonly AlertRuleResourceData _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 AlertRuleResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AlertRuleResource(ArmClient client, AlertRuleResourceData 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 AlertRuleResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _alertRuleResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string alertRuleResourceApiVersion); + _alertRuleResourceRestClient = new AlertRuleResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, alertRuleResourceApiVersion); +#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 AlertRuleResourceData 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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Get"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.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 AlertRuleResource(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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Get"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Delete"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _alertRuleResourceRestClient.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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Delete"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _alertRuleResourceRestClient.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, AlertRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Update"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _alertRuleResourceRestClient.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 AlertRuleResource(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, AlertRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResource.Update"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _alertRuleResourceRestClient.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 AlertRuleResource(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/AlertRuleResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceCollection.cs new file mode 100644 index 000000000000..de00e95cf4cb --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceCollection.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 an instance call the GetAlertRuleResources method from an instance of . + /// + public partial class AlertRuleResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _alertRuleResourceClientDiagnostics; + private readonly AlertRuleResourcesRestOperations _alertRuleResourceRestClient; + + /// Initializes a new instance of the class for mocking. + protected AlertRuleResourceCollection() + { + } + + /// 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 AlertRuleResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _alertRuleResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", AlertRuleResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AlertRuleResource.ResourceType, out string alertRuleResourceApiVersion); + _alertRuleResourceRestClient = new AlertRuleResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, alertRuleResourceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WatcherResource.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, AlertRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data, cancellationToken).ConfigureAwait(false); + var uri = _alertRuleResourceRestClient.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 AlertRuleResource(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, AlertRuleResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(alertRuleResourceName, nameof(alertRuleResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, data, cancellationToken); + var uri = _alertRuleResourceRestClient.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 AlertRuleResource(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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.Get"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.Get"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(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) => _alertRuleResourceRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _alertRuleResourceRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AlertRuleResource(Client, AlertRuleResourceData.DeserializeAlertRuleResourceData(e)), _alertRuleResourceClientDiagnostics, Pipeline, "AlertRuleResourceCollection.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) => _alertRuleResourceRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _alertRuleResourceRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AlertRuleResource(Client, AlertRuleResourceData.DeserializeAlertRuleResourceData(e)), _alertRuleResourceClientDiagnostics, Pipeline, "AlertRuleResourceCollection.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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.Exists"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _alertRuleResourceRestClient.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 AlertRuleResource(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 = _alertRuleResourceClientDiagnostics.CreateScope("AlertRuleResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _alertRuleResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, alertRuleResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AlertRuleResource(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/AlertRuleResourceData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.Serialization.cs new file mode 100644 index 000000000000..080c88758721 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.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 AlertRuleResourceData : 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(AlertRuleResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + AlertRuleResourceData 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(AlertRuleResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAlertRuleResourceData(document.RootElement, options); + } + + internal static AlertRuleResourceData DeserializeAlertRuleResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AlertRuleResourceProperties 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 = AlertRuleResourceProperties.DeserializeAlertRuleResourceProperties(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 AlertRuleResourceData( + 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(AlertRuleResourceData)} does not support writing '{options.Format}' format."); + } + } + + AlertRuleResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAlertRuleResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AlertRuleResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.cs new file mode 100644 index 000000000000..496720664a3a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/AlertRuleResourceData.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 AlertRuleResource data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class AlertRuleResourceData : 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 AlertRuleResourceData() + { + } + + /// 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 AlertRuleResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AlertRuleResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public AlertRuleResourceProperties Properties { get; set; } + } +} 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..338627741f12 --- /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 SharedPrivateLinkResourceData SharedPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SharedPrivateLinkResourceProperties properties = null) + { + return new SharedPrivateLinkResourceData( + 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 SharedPrivateLinkResourceProperties SharedPrivateLinkResourceProperties(ResourceIdentifier privateLinkResourceId = null, string groupId = null, string requestMessage = null, string dnsZone = null, SharedPrivateLinkResourceStatus? status = null, ResourceProvisioningState? provisioningState = null) + { + return new SharedPrivateLinkResourceProperties( + 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 TargetData TargetData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TargetProperties properties = null) + { + return new TargetData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Discriminator property for TargetProperties. + /// 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 TargetProperties TargetProperties(string targetType = null, TargetAuthenticationType targetAuthenticationType = default, VaultSecret targetVault = null, string connectionServerName = null, ResourceProvisioningState? provisioningState = null) + { + return new UnknownTargetProperties( + 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, VaultSecret targetVault = null, string connectionServerName = null, ResourceProvisioningState? 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, VaultSecret targetVault = null, string connectionServerName = null, ResourceProvisioningState? 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, VaultSecret targetVault = null, string connectionServerName = null, ResourceProvisioningState? 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 HealthValidationData HealthValidationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, HealthValidationProperties properties = null) + { + return new HealthValidationData( + 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 HealthValidationProperties HealthValidationProperties(DateTimeOffset startOn = default, DateTimeOffset endOn = default, ValidationStatus status = default, IEnumerable issues = null, ResourceProvisioningState? provisioningState = null) + { + issues ??= new List(); + + return new HealthValidationProperties( + 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 ValidationIssue ValidationIssue(string errorCode = null, string errorMessage = null, string additionalDetails = null, string recommendationMessage = null, Uri recommendationUri = null, ResourceIdentifier relatedResourceId = null, string relatedResourceType = null) + { + return new ValidationIssue( + 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 AlertRuleResourceData AlertRuleResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AlertRuleResourceProperties properties = null) + { + return new AlertRuleResourceData( + 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 AlertRuleResourceProperties AlertRuleResourceProperties(ResourceIdentifier alertRuleResourceId = null, AlertRuleCreationProperty createdWithProperties = default, DateTimeOffset createdOn = default, ResourceProvisioningState? provisioningState = null, string alertRuleTemplateId = null, string alertRuleTemplateVersion = null) + { + return new AlertRuleResourceProperties( + 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 WatcherData WatcherData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, WatcherProperties properties = null, ManagedServiceIdentityV4 identity = null) + { + tags ??= new Dictionary(); + + return new WatcherData( + 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 WatcherProperties WatcherProperties(Datastore datastore = null, WatcherStatus? status = null, DatabaseWatcherProvisioningState? provisioningState = null, ResourceIdentifier defaultAlertRuleIdentityResourceId = null) + { + return new WatcherProperties(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/Extensions/DatabaseWatcherExtensions.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Extensions/DatabaseWatcherExtensions.cs new file mode 100644 index 000000000000..6e392bbd6658 --- /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 WatcherResource GetWatcherResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetWatcherResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AlertRuleResource GetAlertRuleResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetAlertRuleResource(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 HealthValidationResource GetHealthValidationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetHealthValidationResource(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 TargetResource GetTargetResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetTargetResource(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 SharedPrivateLinkResource GetSharedPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableDatabaseWatcherArmClient(client).GetSharedPrivateLinkResource(id); + } + + /// + /// Gets a collection of WatcherResources 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 WatcherResources and their operations over a WatcherResource. + public static WatcherCollection GetWatchers(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetWatchers(); + } + + /// + /// 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> GetWatcherAsync(this ResourceGroupResource resourceGroupResource, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetWatcherAsync(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 GetWatcher(this ResourceGroupResource resourceGroupResource, string watcherName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableDatabaseWatcherResourceGroupResource(resourceGroupResource).GetWatcher(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 GetWatchersAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDatabaseWatcherSubscriptionResource(subscriptionResource).GetWatchersAsync(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 GetWatchers(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDatabaseWatcherSubscriptionResource(subscriptionResource).GetWatchers(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..43c0fc1c282d --- /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 WatcherResource GetWatcherResource(ResourceIdentifier id) + { + WatcherResource.ValidateResourceId(id); + return new WatcherResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AlertRuleResource GetAlertRuleResource(ResourceIdentifier id) + { + AlertRuleResource.ValidateResourceId(id); + return new AlertRuleResource(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 HealthValidationResource GetHealthValidationResource(ResourceIdentifier id) + { + HealthValidationResource.ValidateResourceId(id); + return new HealthValidationResource(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 TargetResource GetTargetResource(ResourceIdentifier id) + { + TargetResource.ValidateResourceId(id); + return new TargetResource(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 SharedPrivateLinkResource GetSharedPrivateLinkResource(ResourceIdentifier id) + { + SharedPrivateLinkResource.ValidateResourceId(id); + return new SharedPrivateLinkResource(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..9efa41ebf78d --- /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 WatcherResources in the ResourceGroupResource. + /// An object representing collection of WatcherResources and their operations over a WatcherResource. + public virtual WatcherCollection GetWatchers() + { + return GetCachedClient(client => new WatcherCollection(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> GetWatcherAsync(string watcherName, CancellationToken cancellationToken = default) + { + return await GetWatchers().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 GetWatcher(string watcherName, CancellationToken cancellationToken = default) + { + return GetWatchers().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..9b9e305ea5a0 --- /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 _watcherClientDiagnostics; + private WatchersRestOperations _watcherRestClient; + + /// 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 WatcherClientDiagnostics => _watcherClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", WatcherResource.ResourceType.Namespace, Diagnostics); + private WatchersRestOperations WatcherRestClient => _watcherRestClient ??= new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(WatcherResource.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 GetWatchersAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WatcherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WatcherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WatcherResource(Client, WatcherData.DeserializeWatcherData(e)), WatcherClientDiagnostics, Pipeline, "MockableDatabaseWatcherSubscriptionResource.GetWatchers", "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 GetWatchers(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => WatcherRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => WatcherRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WatcherResource(Client, WatcherData.DeserializeWatcherData(e)), WatcherClientDiagnostics, Pipeline, "MockableDatabaseWatcherSubscriptionResource.GetWatchers", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationCollection.cs new file mode 100644 index 000000000000..b9af214f6894 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationCollection.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 GetHealthValidations method from an instance of . + /// + public partial class HealthValidationCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _healthValidationClientDiagnostics; + private readonly HealthValidationsRestOperations _healthValidationRestClient; + + /// Initializes a new instance of the class for mocking. + protected HealthValidationCollection() + { + } + + /// 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 HealthValidationCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _healthValidationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", HealthValidationResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(HealthValidationResource.ResourceType, out string healthValidationApiVersion); + _healthValidationRestClient = new HealthValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, healthValidationApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WatcherResource.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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.Get"); + scope.Start(); + try + { + var response = await _healthValidationRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HealthValidationResource(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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.Get"); + scope.Start(); + try + { + var response = _healthValidationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HealthValidationResource(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) => _healthValidationRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _healthValidationRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new HealthValidationResource(Client, HealthValidationData.DeserializeHealthValidationData(e)), _healthValidationClientDiagnostics, Pipeline, "HealthValidationCollection.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) => _healthValidationRestClient.CreateListByParentRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _healthValidationRestClient.CreateListByParentNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new HealthValidationResource(Client, HealthValidationData.DeserializeHealthValidationData(e)), _healthValidationClientDiagnostics, Pipeline, "HealthValidationCollection.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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.Exists"); + scope.Start(); + try + { + var response = await _healthValidationRestClient.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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.Exists"); + scope.Start(); + try + { + var response = _healthValidationRestClient.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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _healthValidationRestClient.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 HealthValidationResource(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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationCollection.GetIfExists"); + scope.Start(); + try + { + var response = _healthValidationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, healthValidationName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new HealthValidationResource(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/HealthValidationData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.Serialization.cs new file mode 100644 index 000000000000..702adcb7971d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.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 HealthValidationData : 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(HealthValidationData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + HealthValidationData 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(HealthValidationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthValidationData(document.RootElement, options); + } + + internal static HealthValidationData DeserializeHealthValidationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HealthValidationProperties 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 = HealthValidationProperties.DeserializeHealthValidationProperties(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 HealthValidationData( + 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(HealthValidationData)} does not support writing '{options.Format}' format."); + } + } + + HealthValidationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthValidationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthValidationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.cs new file mode 100644 index 000000000000..d261752d66de --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationData.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 HealthValidation data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class HealthValidationData : 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 HealthValidationData() + { + } + + /// 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 HealthValidationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, HealthValidationProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public HealthValidationProperties Properties { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.Serialization.cs new file mode 100644 index 000000000000..86d73ed6ee91 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.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 HealthValidationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + HealthValidationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + HealthValidationData 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/HealthValidationResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.cs new file mode 100644 index 000000000000..c43c0dfacf3d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/HealthValidationResource.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 HealthValidation 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 GetHealthValidationResource method. + /// Otherwise you can get one from its parent resource using the GetHealthValidation method. + /// + public partial class HealthValidationResource : 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 _healthValidationClientDiagnostics; + private readonly HealthValidationsRestOperations _healthValidationRestClient; + private readonly HealthValidationData _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 HealthValidationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal HealthValidationResource(ArmClient client, HealthValidationData 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 HealthValidationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _healthValidationClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string healthValidationApiVersion); + _healthValidationRestClient = new HealthValidationsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, healthValidationApiVersion); +#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 HealthValidationData 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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationResource.Get"); + scope.Start(); + try + { + var response = await _healthValidationRestClient.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 HealthValidationResource(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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationResource.Get"); + scope.Start(); + try + { + var response = _healthValidationRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new HealthValidationResource(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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationResource.StartValidation"); + scope.Start(); + try + { + var response = await _healthValidationRestClient.StartValidationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new HealthValidationOperationSource(Client), _healthValidationClientDiagnostics, Pipeline, _healthValidationRestClient.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 = _healthValidationClientDiagnostics.CreateScope("HealthValidationResource.StartValidation"); + scope.Start(); + try + { + var response = _healthValidationRestClient.StartValidation(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new HealthValidationOperationSource(Client), _healthValidationClientDiagnostics, Pipeline, _healthValidationRestClient.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/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..042bb5f708f5 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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 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/HealthValidationOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/HealthValidationOperationSource.cs new file mode 100644 index 000000000000..1db65fe7c9b6 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/HealthValidationOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal class HealthValidationOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal HealthValidationOperationSource(ArmClient client) + { + _client = client; + } + + HealthValidationResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = HealthValidationData.DeserializeHealthValidationData(document.RootElement); + return new HealthValidationResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = HealthValidationData.DeserializeHealthValidationData(document.RootElement); + return new HealthValidationResource(_client, data); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/SharedPrivateLinkResourceOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/SharedPrivateLinkResourceOperationSource.cs new file mode 100644 index 000000000000..eb2d0282f266 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/SharedPrivateLinkResourceOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal class SharedPrivateLinkResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SharedPrivateLinkResourceOperationSource(ArmClient client) + { + _client = client; + } + + SharedPrivateLinkResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(document.RootElement); + return new SharedPrivateLinkResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(document.RootElement); + return new SharedPrivateLinkResource(_client, data); + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/WatcherOperationSource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/WatcherOperationSource.cs new file mode 100644 index 000000000000..31cbf348dae8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/LongRunningOperation/WatcherOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.DatabaseWatcher +{ + internal class WatcherOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal WatcherOperationSource(ArmClient client) + { + _client = client; + } + + WatcherResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = WatcherData.DeserializeWatcherData(document.RootElement); + return new WatcherResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = WatcherData.DeserializeWatcherData(document.RootElement); + return new WatcherResource(_client, data); + } + } +} 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..4b6de8bfbc13 --- /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)) + { + 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(AlertRuleResourceData.DeserializeAlertRuleResourceData(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); + 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..3a2a86a9d0e8 --- /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/AlertRuleResourceProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.Serialization.cs new file mode 100644 index 000000000000..04ae44267dbc --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.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 AlertRuleResourceProperties : 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(AlertRuleResourceProperties)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AlertRuleResourceProperties 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(AlertRuleResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAlertRuleResourceProperties(document.RootElement, options); + } + + internal static AlertRuleResourceProperties DeserializeAlertRuleResourceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier alertRuleResourceId = default; + AlertRuleCreationProperty createdWithProperties = default; + DateTimeOffset creationTime = default; + ResourceProvisioningState? 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 ResourceProvisioningState(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 AlertRuleResourceProperties( + 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(AlertRuleResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + AlertRuleResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAlertRuleResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AlertRuleResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.cs new file mode 100644 index 000000000000..81d7429e72f0 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/AlertRuleResourceProperties.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 AlertRuleResourceProperties + { + /// + /// 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 AlertRuleResourceProperties(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 AlertRuleResourceProperties(ResourceIdentifier alertRuleResourceId, AlertRuleCreationProperty createdWithProperties, DateTimeOffset createdOn, ResourceProvisioningState? 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 AlertRuleResourceProperties() + { + } + + /// 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 ResourceProvisioningState? 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/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/Datastore.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.Serialization.cs new file mode 100644 index 000000000000..d2a52e768ada --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.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 Datastore : 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(Datastore)} 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); + writer.WritePropertyName("kustoDataIngestionUri"u8); + writer.WriteStringValue(KustoDataIngestionUri); + writer.WritePropertyName("kustoDatabaseName"u8); + writer.WriteStringValue(KustoDatabaseName); + writer.WritePropertyName("kustoManagementUrl"u8); + writer.WriteStringValue(KustoManagementUri); + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Datastore 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(Datastore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatastore(document.RootElement, options); + } + + internal static Datastore DeserializeDatastore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier adxClusterResourceId = default; + string kustoClusterDisplayName = default; + string kustoClusterUri = default; + string kustoDataIngestionUri = default; + string kustoDatabaseName = default; + string 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 = property.Value.GetString(); + continue; + } + if (property.NameEquals("kustoDataIngestionUri"u8)) + { + kustoDataIngestionUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("kustoDatabaseName"u8)) + { + kustoDatabaseName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kustoManagementUrl"u8)) + { + kustoManagementUrl = 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 Datastore( + 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(Datastore)} does not support writing '{options.Format}' format."); + } + } + + Datastore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatastore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Datastore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.cs new file mode 100644 index 000000000000..a5fb7745f3a7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/Datastore.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 Datastore + { + /// + /// 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 Datastore(string kustoClusterUri, string kustoDataIngestionUri, string kustoDatabaseName, string 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 Datastore(ResourceIdentifier adxClusterResourceId, string kustoClusterDisplayName, string kustoClusterUri, string kustoDataIngestionUri, string kustoDatabaseName, string 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 Datastore() + { + } + + /// 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 string KustoClusterUri { get; set; } + /// The Kusto data ingestion URI. + public string KustoDataIngestionUri { get; set; } + /// The name of a Kusto database. + public string KustoDatabaseName { get; set; } + /// The Kusto management URL. + public string 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/HealthValidationListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationListResult.Serialization.cs new file mode 100644 index 000000000000..c9bb89b1a451 --- /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)) + { + 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(HealthValidationData.DeserializeHealthValidationData(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); + 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..7de6b1d74262 --- /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/HealthValidationProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.Serialization.cs new file mode 100644 index 000000000000..3c80423b8ade --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.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 HealthValidationProperties : 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(HealthValidationProperties)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HealthValidationProperties 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(HealthValidationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHealthValidationProperties(document.RootElement, options); + } + + internal static HealthValidationProperties DeserializeHealthValidationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset startTime = default; + DateTimeOffset endTime = default; + ValidationStatus status = default; + IReadOnlyList issues = default; + ResourceProvisioningState? 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 ValidationStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("issues"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ValidationIssue.DeserializeValidationIssue(item, options)); + } + issues = array; + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HealthValidationProperties( + 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(HealthValidationProperties)} does not support writing '{options.Format}' format."); + } + } + + HealthValidationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHealthValidationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HealthValidationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.cs new file mode 100644 index 000000000000..963f55c00df1 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/HealthValidationProperties.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 HealthValidationProperties + { + /// + /// 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 HealthValidationProperties(DateTimeOffset startOn, DateTimeOffset endOn, ValidationStatus 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 HealthValidationProperties(DateTimeOffset startOn, DateTimeOffset endOn, ValidationStatus status, IReadOnlyList issues, ResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + Status = status; + Issues = issues; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal HealthValidationProperties() + { + } + + /// 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 ValidationStatus Status { get; } + /// The list of issues found by health validation. + public IReadOnlyList Issues { get; } + /// The provisioning state of the health validation resource. + public ResourceProvisioningState? ProvisioningState { 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..6f6c061eb3c8 --- /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)) + { + 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); + 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/ResourceProvisioningState.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..ef613439b6ab --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ResourceProvisioningState.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 ResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceProvisioningState(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 ResourceProvisioningState Succeeded { get; } = new ResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static ResourceProvisioningState Failed { get; } = new ResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ResourceProvisioningState Canceled { get; } = new ResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceProvisioningState left, ResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceProvisioningState left, ResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceProvisioningState(string value) => new ResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceProvisioningState other && Equals(other); + /// + public bool Equals(ResourceProvisioningState 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/SharedPrivateLinkResourceListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceListResult.Serialization.cs new file mode 100644 index 000000000000..d5dd91e594f4 --- /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)) + { + 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(SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(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); + 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..bc7a9e3ee202 --- /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/SharedPrivateLinkResourceProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.Serialization.cs new file mode 100644 index 000000000000..188661a910af --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.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 SharedPrivateLinkResourceProperties : 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(SharedPrivateLinkResourceProperties)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SharedPrivateLinkResourceProperties 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(SharedPrivateLinkResourceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSharedPrivateLinkResourceProperties(document.RootElement, options); + } + + internal static SharedPrivateLinkResourceProperties DeserializeSharedPrivateLinkResourceProperties(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; + SharedPrivateLinkResourceStatus? status = default; + ResourceProvisioningState? 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 SharedPrivateLinkResourceStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SharedPrivateLinkResourceProperties( + 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(SharedPrivateLinkResourceProperties)} does not support writing '{options.Format}' format."); + } + } + + SharedPrivateLinkResourceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSharedPrivateLinkResourceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SharedPrivateLinkResourceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.cs new file mode 100644 index 000000000000..e7a80cc7cca3 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceProperties.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 SharedPrivateLinkResourceProperties + { + /// + /// 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 SharedPrivateLinkResourceProperties(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 SharedPrivateLinkResourceProperties(ResourceIdentifier privateLinkResourceId, string groupId, string requestMessage, string dnsZone, SharedPrivateLinkResourceStatus? status, ResourceProvisioningState? 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 SharedPrivateLinkResourceProperties() + { + } + + /// 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 SharedPrivateLinkResourceStatus? Status { get; } + /// The provisioning state of the resource. + public ResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceStatus.cs new file mode 100644 index 000000000000..b0ac514fd1d4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SharedPrivateLinkResourceStatus.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 SharedPrivateLinkResourceStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SharedPrivateLinkResourceStatus(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 SharedPrivateLinkResourceStatus Pending { get; } = new SharedPrivateLinkResourceStatus(PendingValue); + /// The shared private link connection request was approved by the resource owner. + public static SharedPrivateLinkResourceStatus Approved { get; } = new SharedPrivateLinkResourceStatus(ApprovedValue); + /// The shared private link connection request was rejected by the resource owner. + public static SharedPrivateLinkResourceStatus Rejected { get; } = new SharedPrivateLinkResourceStatus(RejectedValue); + /// The shared private link connection request was disconnected by the resource owner. + public static SharedPrivateLinkResourceStatus Disconnected { get; } = new SharedPrivateLinkResourceStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(SharedPrivateLinkResourceStatus left, SharedPrivateLinkResourceStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SharedPrivateLinkResourceStatus left, SharedPrivateLinkResourceStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SharedPrivateLinkResourceStatus(string value) => new SharedPrivateLinkResourceStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SharedPrivateLinkResourceStatus other && Equals(other); + /// + public bool Equals(SharedPrivateLinkResourceStatus 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/SqlDbElasticPoolTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/SqlDbElasticPoolTargetProperties.Serialization.cs new file mode 100644 index 000000000000..4573e62e8fdb --- /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; + VaultSecret targetVault = default; + string connectionServerName = default; + ResourceProvisioningState? 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 = VaultSecret.DeserializeVaultSecret(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 ResourceProvisioningState(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); + 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..3b1bc634e486 --- /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 : TargetProperties + { + /// 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 TargetProperties. + /// 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, VaultSecret targetVault, string connectionServerName, ResourceProvisioningState? 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..f43750b9adfa --- /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; + VaultSecret targetVault = default; + string connectionServerName = default; + ResourceProvisioningState? 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 = VaultSecret.DeserializeVaultSecret(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 ResourceProvisioningState(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); + 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..e91b17ceb4bc --- /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 : TargetProperties + { + /// 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 TargetProperties. + /// 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, VaultSecret targetVault, string connectionServerName, ResourceProvisioningState? 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..5689a5a1dceb --- /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; + VaultSecret targetVault = default; + string connectionServerName = default; + ResourceProvisioningState? 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 = VaultSecret.DeserializeVaultSecret(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 ResourceProvisioningState(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); + 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..42d4e454cc90 --- /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 : TargetProperties + { + /// 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 TargetProperties. + /// 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, VaultSecret targetVault, string connectionServerName, ResourceProvisioningState? 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/TargetListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetListResult.Serialization.cs new file mode 100644 index 000000000000..2f49056cd2f0 --- /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)) + { + 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(TargetData.DeserializeTargetData(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); + 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..259a91b4264e --- /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/TargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.Serialization.cs new file mode 100644 index 000000000000..339824717aae --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.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(UnknownTargetProperties))] + public partial class TargetProperties : 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(TargetProperties)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetProperties 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(TargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetProperties(document.RootElement, options); + } + + internal static TargetProperties DeserializeTargetProperties(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 UnknownTargetProperties.DeserializeUnknownTargetProperties(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(TargetProperties)} does not support writing '{options.Format}' format."); + } + } + + TargetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.cs new file mode 100644 index 000000000000..d1adb92b5d4d --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/TargetProperties.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 TargetProperties + { + /// + /// 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 TargetProperties(TargetAuthenticationType targetAuthenticationType, string connectionServerName) + { + Argument.AssertNotNull(connectionServerName, nameof(connectionServerName)); + + TargetAuthenticationType = targetAuthenticationType; + ConnectionServerName = connectionServerName; + } + + /// Initializes a new instance of . + /// Discriminator property for TargetProperties. + /// 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 TargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, VaultSecret targetVault, string connectionServerName, ResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + TargetType = targetType; + TargetAuthenticationType = targetAuthenticationType; + TargetVault = targetVault; + ConnectionServerName = connectionServerName; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal TargetProperties() + { + } + + /// Discriminator property for TargetProperties. + 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 VaultSecret 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 ResourceProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.Serialization.cs new file mode 100644 index 000000000000..8839205ad17b --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.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 UnknownTargetProperties : 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(TargetProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + TargetProperties 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(TargetProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetProperties(document.RootElement, options); + } + + internal static UnknownTargetProperties DeserializeUnknownTargetProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string targetType = "Unknown"; + TargetAuthenticationType targetAuthenticationType = default; + VaultSecret targetVault = default; + string connectionServerName = default; + ResourceProvisioningState? 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 = VaultSecret.DeserializeVaultSecret(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 ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownTargetProperties( + 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(TargetProperties)} does not support writing '{options.Format}' format."); + } + } + + TargetProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.cs new file mode 100644 index 000000000000..76b54f72ec12 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/UnknownTargetProperties.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 TargetProperties. + internal partial class UnknownTargetProperties : TargetProperties + { + /// Initializes a new instance of . + /// Discriminator property for TargetProperties. + /// 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 UnknownTargetProperties(string targetType, TargetAuthenticationType targetAuthenticationType, VaultSecret targetVault, string connectionServerName, ResourceProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) : base(targetType, targetAuthenticationType, targetVault, connectionServerName, provisioningState, serializedAdditionalRawData) + { + TargetType = targetType ?? "Unknown"; + } + + /// Initializes a new instance of for deserialization. + internal UnknownTargetProperties() + { + } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.Serialization.cs new file mode 100644 index 000000000000..310bd65bc1e2 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.Serialization.cs @@ -0,0 +1,211 @@ +// 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 ValidationIssue : 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(ValidationIssue)} 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); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ValidationIssue 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(ValidationIssue)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeValidationIssue(document.RootElement, options); + } + + internal static ValidationIssue DeserializeValidationIssue(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; + string 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)) + { + relatedResourceType = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ValidationIssue( + 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(ValidationIssue)} does not support writing '{options.Format}' format."); + } + } + + ValidationIssue IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeValidationIssue(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ValidationIssue)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.cs new file mode 100644 index 000000000000..5cf33b03fc68 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationIssue.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 ValidationIssue + { + /// + /// 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 ValidationIssue(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 ValidationIssue(string errorCode, string errorMessage, string additionalDetails, string recommendationMessage, Uri recommendationUri, ResourceIdentifier relatedResourceId, string 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 ValidationIssue() + { + } + + /// 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 string RelatedResourceType { get; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationStatus.cs new file mode 100644 index 000000000000..91cdfb16fa7a --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/ValidationStatus.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 ValidationStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ValidationStatus(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 ValidationStatus NotStarted { get; } = new ValidationStatus(NotStartedValue); + /// Health validation is running. + public static ValidationStatus Running { get; } = new ValidationStatus(RunningValue); + /// Health validation completed successfully. + public static ValidationStatus Succeeded { get; } = new ValidationStatus(SucceededValue); + /// Health validation failed. + public static ValidationStatus Failed { get; } = new ValidationStatus(FailedValue); + /// Health validation was canceled. + public static ValidationStatus Canceled { get; } = new ValidationStatus(CanceledValue); + /// Health validation timed out. + public static ValidationStatus TimedOut { get; } = new ValidationStatus(TimedOutValue); + /// Determines if two values are the same. + public static bool operator ==(ValidationStatus left, ValidationStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ValidationStatus left, ValidationStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ValidationStatus(string value) => new ValidationStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ValidationStatus other && Equals(other); + /// + public bool Equals(ValidationStatus 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/VaultSecret.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.Serialization.cs new file mode 100644 index 000000000000..fb1f3c4357b8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.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 VaultSecret : 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(VaultSecret)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + VaultSecret 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(VaultSecret)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVaultSecret(document.RootElement, options); + } + + internal static VaultSecret DeserializeVaultSecret(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 VaultSecret(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(VaultSecret)} does not support writing '{options.Format}' format."); + } + } + + VaultSecret IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeVaultSecret(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VaultSecret)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.cs new file mode 100644 index 000000000000..0a2c32493558 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/VaultSecret.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 VaultSecret + { + /// + /// 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 VaultSecret() + { + } + + /// 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 VaultSecret(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/WatcherListResult.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherListResult.Serialization.cs new file mode 100644 index 000000000000..de252e1abb9e --- /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)) + { + 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(WatcherData.DeserializeWatcherData(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); + 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..13fbd3c33992 --- /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/WatcherPatch.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.Serialization.cs new file mode 100644 index 000000000000..700a3eb45267 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.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 WatcherPatch : 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(WatcherPatch)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WatcherPatch 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(WatcherPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWatcherPatch(document.RootElement, options); + } + + internal static WatcherPatch DeserializeWatcherPatch(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 WatcherPatch(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(WatcherPatch)} does not support writing '{options.Format}' format."); + } + } + + WatcherPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWatcherPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WatcherPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.cs new file mode 100644 index 000000000000..59324b3e1f44 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherPatch.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 WatcherPatch + { + /// + /// 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 WatcherPatch() + { + 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 WatcherPatch(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/WatcherProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.Serialization.cs new file mode 100644 index 000000000000..4ab4881f4833 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.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 WatcherProperties : 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(WatcherProperties)} 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WatcherProperties 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(WatcherProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWatcherProperties(document.RootElement, options); + } + + internal static WatcherProperties DeserializeWatcherProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Datastore datastore = default; + WatcherStatus? 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 = Datastore.DeserializeDatastore(property.Value, options); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new WatcherStatus(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 WatcherProperties(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(WatcherProperties)} does not support writing '{options.Format}' format."); + } + } + + WatcherProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWatcherProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WatcherProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.cs new file mode 100644 index 000000000000..1d6b63a67ef7 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherProperties.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 WatcherProperties + { + /// + /// 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 WatcherProperties() + { + } + + /// 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 WatcherProperties(Datastore datastore, WatcherStatus? 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 Datastore Datastore { get; set; } + /// The monitoring collection status of the watcher. + public WatcherStatus? 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/WatcherStatus.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherStatus.cs new file mode 100644 index 000000000000..302a581fe79e --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherStatus.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 WatcherStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public WatcherStatus(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 WatcherStatus Starting { get; } = new WatcherStatus(StartingValue); + /// Denotes the watcher is in a running state. + public static WatcherStatus Running { get; } = new WatcherStatus(RunningValue); + /// Denotes the watcher is in a stopping state. + public static WatcherStatus Stopping { get; } = new WatcherStatus(StoppingValue); + /// Denotes the watcher is in a stopped state. + public static WatcherStatus Stopped { get; } = new WatcherStatus(StoppedValue); + /// Denotes the watcher is in a deleting state. + public static WatcherStatus Deleting { get; } = new WatcherStatus(DeletingValue); + /// Determines if two values are the same. + public static bool operator ==(WatcherStatus left, WatcherStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(WatcherStatus left, WatcherStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator WatcherStatus(string value) => new WatcherStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is WatcherStatus other && Equals(other); + /// + public bool Equals(WatcherStatus 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/WatcherUpdateProperties.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/Models/WatcherUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..02dbddbb9cdd --- /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)) + { + 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; + } + Datastore 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 = Datastore.DeserializeDatastore(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); + 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..efbe98de6d9e --- /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(Datastore datastore, ResourceIdentifier defaultAlertRuleIdentityResourceId, IDictionary serializedAdditionalRawData) + { + Datastore = datastore; + DefaultAlertRuleIdentityResourceId = defaultAlertRuleIdentityResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The data store for collected monitoring data. + public Datastore 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..2c9fb5ca2e7f --- /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: + { + AlertRuleResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AlertRuleResourceData.DeserializeAlertRuleResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AlertRuleResourceData)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: + { + AlertRuleResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AlertRuleResourceData.DeserializeAlertRuleResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AlertRuleResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string alertRuleResourceName, AlertRuleResourceData 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, AlertRuleResourceData 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, AlertRuleResourceData 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: + { + AlertRuleResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AlertRuleResourceData.DeserializeAlertRuleResourceData(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, AlertRuleResourceData 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: + { + AlertRuleResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AlertRuleResourceData.DeserializeAlertRuleResourceData(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, default, 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); + 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, default, 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); + 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..37df4a8b8142 --- /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: + { + HealthValidationData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = HealthValidationData.DeserializeHealthValidationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HealthValidationData)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: + { + HealthValidationData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = HealthValidationData.DeserializeHealthValidationData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((HealthValidationData)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, default, 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); + 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, default, 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); + 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..3ab54b61518a --- /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: + { + SharedPrivateLinkResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SharedPrivateLinkResourceData)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: + { + SharedPrivateLinkResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SharedPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string sharedPrivateLinkResourceName, SharedPrivateLinkResourceData 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, SharedPrivateLinkResourceData 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, SharedPrivateLinkResourceData 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, SharedPrivateLinkResourceData 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, default, 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); + 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, default, 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); + 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..373a87db6065 --- /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: + { + TargetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TargetData.DeserializeTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TargetData)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: + { + TargetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TargetData.DeserializeTargetData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((TargetData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, string targetName, TargetData 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, TargetData 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, TargetData 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: + { + TargetData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = TargetData.DeserializeTargetData(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, TargetData 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: + { + TargetData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = TargetData.DeserializeTargetData(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, default, 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); + 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, default, 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); + 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..5d32fbe3a59d --- /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: + { + WatcherData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WatcherData.DeserializeWatcherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WatcherData)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: + { + WatcherData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WatcherData.DeserializeWatcherData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WatcherData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string watcherName, WatcherData 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, WatcherData 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, WatcherData 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, WatcherData 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, WatcherPatch 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, WatcherPatch 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, WatcherPatch 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, WatcherPatch 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, default, 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); + 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, default, 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); + 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, default, 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); + 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, default, 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); + 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/Generated/SharedPrivateLinkResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResource.Serialization.cs new file mode 100644 index 000000000000..f50fbe916eab --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResource.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 SharedPrivateLinkResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SharedPrivateLinkResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SharedPrivateLinkResourceData 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/SharedPrivateLinkResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResource.cs new file mode 100644 index 000000000000..9a49a30dacff --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResource.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 SharedPrivateLinkResource 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 GetSharedPrivateLinkResource method. + /// Otherwise you can get one from its parent resource using the GetSharedPrivateLinkResource method. + /// + public partial class SharedPrivateLinkResource : 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 _sharedPrivateLinkResourceClientDiagnostics; + private readonly SharedPrivateLinkResourcesRestOperations _sharedPrivateLinkResourceRestClient; + private readonly SharedPrivateLinkResourceData _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 SharedPrivateLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SharedPrivateLinkResource(ArmClient client, SharedPrivateLinkResourceData 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 SharedPrivateLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _sharedPrivateLinkResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string sharedPrivateLinkResourceApiVersion); + _sharedPrivateLinkResourceRestClient = new SharedPrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sharedPrivateLinkResourceApiVersion); +#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 SharedPrivateLinkResourceData 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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.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 SharedPrivateLinkResource(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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SharedPrivateLinkResource(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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Delete"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Delete"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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, SharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Update"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new SharedPrivateLinkResourceOperationSource(Client), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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, SharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResource.Update"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new SharedPrivateLinkResourceOperationSource(Client), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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/SharedPrivateLinkResourceCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..381ddc746320 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceCollection.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 GetSharedPrivateLinkResources method from an instance of . + /// + public partial class SharedPrivateLinkResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _sharedPrivateLinkResourceClientDiagnostics; + private readonly SharedPrivateLinkResourcesRestOperations _sharedPrivateLinkResourceRestClient; + + /// Initializes a new instance of the class for mocking. + protected SharedPrivateLinkResourceCollection() + { + } + + /// 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 SharedPrivateLinkResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _sharedPrivateLinkResourceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", SharedPrivateLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SharedPrivateLinkResource.ResourceType, out string sharedPrivateLinkResourceApiVersion); + _sharedPrivateLinkResourceRestClient = new SharedPrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, sharedPrivateLinkResourceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WatcherResource.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, SharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new SharedPrivateLinkResourceOperationSource(Client), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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, SharedPrivateLinkResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(sharedPrivateLinkResourceName, nameof(sharedPrivateLinkResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new SharedPrivateLinkResourceOperationSource(Client), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, _sharedPrivateLinkResourceRestClient.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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SharedPrivateLinkResource(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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SharedPrivateLinkResource(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) => _sharedPrivateLinkResourceRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedPrivateLinkResourceRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SharedPrivateLinkResource(Client, SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(e)), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, "SharedPrivateLinkResourceCollection.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) => _sharedPrivateLinkResourceRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _sharedPrivateLinkResourceRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SharedPrivateLinkResource(Client, SharedPrivateLinkResourceData.DeserializeSharedPrivateLinkResourceData(e)), _sharedPrivateLinkResourceClientDiagnostics, Pipeline, "SharedPrivateLinkResourceCollection.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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _sharedPrivateLinkResourceRestClient.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 SharedPrivateLinkResource(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 = _sharedPrivateLinkResourceClientDiagnostics.CreateScope("SharedPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _sharedPrivateLinkResourceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, sharedPrivateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SharedPrivateLinkResource(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/SharedPrivateLinkResourceData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..00e69ad597b8 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.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 SharedPrivateLinkResourceData : 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(SharedPrivateLinkResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + SharedPrivateLinkResourceData 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(SharedPrivateLinkResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSharedPrivateLinkResourceData(document.RootElement, options); + } + + internal static SharedPrivateLinkResourceData DeserializeSharedPrivateLinkResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SharedPrivateLinkResourceProperties 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 = SharedPrivateLinkResourceProperties.DeserializeSharedPrivateLinkResourceProperties(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 SharedPrivateLinkResourceData( + 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(SharedPrivateLinkResourceData)} does not support writing '{options.Format}' format."); + } + } + + SharedPrivateLinkResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSharedPrivateLinkResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SharedPrivateLinkResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.cs new file mode 100644 index 000000000000..45f2b1b41d87 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/SharedPrivateLinkResourceData.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 SharedPrivateLinkResource data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class SharedPrivateLinkResourceData : 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 SharedPrivateLinkResourceData() + { + } + + /// 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 SharedPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SharedPrivateLinkResourceProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public SharedPrivateLinkResourceProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetCollection.cs new file mode 100644 index 000000000000..4dbbaeab8572 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetCollection.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 GetTargets method from an instance of . + /// + public partial class TargetCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _targetClientDiagnostics; + private readonly TargetsRestOperations _targetRestClient; + + /// Initializes a new instance of the class for mocking. + protected TargetCollection() + { + } + + /// 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 TargetCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _targetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", TargetResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TargetResource.ResourceType, out string targetApiVersion); + _targetRestClient = new TargetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, targetApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WatcherResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WatcherResource.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, TargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _targetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data, cancellationToken).ConfigureAwait(false); + var uri = _targetRestClient.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 TargetResource(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, TargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(targetName, nameof(targetName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _targetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, data, cancellationToken); + var uri = _targetRestClient.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 TargetResource(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 = _targetClientDiagnostics.CreateScope("TargetCollection.Get"); + scope.Start(); + try + { + var response = await _targetRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TargetResource(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 = _targetClientDiagnostics.CreateScope("TargetCollection.Get"); + scope.Start(); + try + { + var response = _targetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TargetResource(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) => _targetRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.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) => _targetRestClient.CreateListByWatcherRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _targetRestClient.CreateListByWatcherNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TargetResource(Client, TargetData.DeserializeTargetData(e)), _targetClientDiagnostics, Pipeline, "TargetCollection.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 = _targetClientDiagnostics.CreateScope("TargetCollection.Exists"); + scope.Start(); + try + { + var response = await _targetRestClient.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 = _targetClientDiagnostics.CreateScope("TargetCollection.Exists"); + scope.Start(); + try + { + var response = _targetRestClient.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 = _targetClientDiagnostics.CreateScope("TargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _targetRestClient.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 TargetResource(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 = _targetClientDiagnostics.CreateScope("TargetCollection.GetIfExists"); + scope.Start(); + try + { + var response = _targetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, targetName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new TargetResource(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/TargetData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.Serialization.cs new file mode 100644 index 000000000000..516a1a20c363 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.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 TargetData : 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(TargetData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + TargetData 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(TargetData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetData(document.RootElement, options); + } + + internal static TargetData DeserializeTargetData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TargetProperties 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 = TargetProperties.DeserializeTargetProperties(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 TargetData( + 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(TargetData)} does not support writing '{options.Format}' format."); + } + } + + TargetData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeTargetData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.cs new file mode 100644 index 000000000000..04dda036ff16 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetData.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 Target data model. + /// Concrete proxy resource types can be created by aliasing this type using a specific property type. + /// + public partial class TargetData : 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 TargetData() + { + } + + /// 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 TargetData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetProperties 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 TargetProperties Properties { get; set; } + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.Serialization.cs new file mode 100644 index 000000000000..64a7c916ca21 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.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 TargetResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + TargetData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + TargetData 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/TargetResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.cs new file mode 100644 index 000000000000..654e6c42cde4 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/TargetResource.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 Target 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 GetTargetResource method. + /// Otherwise you can get one from its parent resource using the GetTarget method. + /// + public partial class TargetResource : 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 _targetClientDiagnostics; + private readonly TargetsRestOperations _targetRestClient; + private readonly TargetData _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 TargetResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TargetResource(ArmClient client, TargetData 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 TargetResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _targetClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string targetApiVersion); + _targetRestClient = new TargetsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, targetApiVersion); +#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 TargetData 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 = _targetClientDiagnostics.CreateScope("TargetResource.Get"); + scope.Start(); + try + { + var response = await _targetRestClient.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 TargetResource(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 = _targetClientDiagnostics.CreateScope("TargetResource.Get"); + scope.Start(); + try + { + var response = _targetRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TargetResource(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 = _targetClientDiagnostics.CreateScope("TargetResource.Delete"); + scope.Start(); + try + { + var response = await _targetRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _targetRestClient.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 = _targetClientDiagnostics.CreateScope("TargetResource.Delete"); + scope.Start(); + try + { + var response = _targetRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _targetRestClient.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, TargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetResource.Update"); + scope.Start(); + try + { + var response = await _targetRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _targetRestClient.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 TargetResource(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, TargetData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _targetClientDiagnostics.CreateScope("TargetResource.Update"); + scope.Start(); + try + { + var response = _targetRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _targetRestClient.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 TargetResource(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/WatcherCollection.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherCollection.cs new file mode 100644 index 000000000000..4ec24987d6d6 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherCollection.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 GetWatchers method from an instance of . + /// + public partial class WatcherCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _watcherClientDiagnostics; + private readonly WatchersRestOperations _watcherRestClient; + + /// Initializes a new instance of the class for mocking. + protected WatcherCollection() + { + } + + /// 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 WatcherCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _watcherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", WatcherResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WatcherResource.ResourceType, out string watcherApiVersion); + _watcherRestClient = new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, watcherApiVersion); +#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, WatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _watcherClientDiagnostics.CreateScope("WatcherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _watcherRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, data, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new WatcherOperationSource(Client), _watcherClientDiagnostics, Pipeline, _watcherRestClient.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, WatcherData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(watcherName, nameof(watcherName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _watcherClientDiagnostics.CreateScope("WatcherCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _watcherRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, watcherName, data, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new WatcherOperationSource(Client), _watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.Get"); + scope.Start(); + try + { + var response = await _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.Get"); + scope.Start(); + try + { + var response = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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) => _watcherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _watcherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WatcherResource(Client, WatcherData.DeserializeWatcherData(e)), _watcherClientDiagnostics, Pipeline, "WatcherCollection.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) => _watcherRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _watcherRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WatcherResource(Client, WatcherData.DeserializeWatcherData(e)), _watcherClientDiagnostics, Pipeline, "WatcherCollection.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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.Exists"); + scope.Start(); + try + { + var response = await _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.Exists"); + scope.Start(); + try + { + var response = _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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 = _watcherClientDiagnostics.CreateScope("WatcherCollection.GetIfExists"); + scope.Start(); + try + { + var response = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, watcherName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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/WatcherData.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.Serialization.cs new file mode 100644 index 000000000000..132d2e09dc8c --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.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 WatcherData : 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(WatcherData)} 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); + } + } + + WatcherData 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(WatcherData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWatcherData(document.RootElement, options); + } + + internal static WatcherData DeserializeWatcherData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WatcherProperties 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 = WatcherProperties.DeserializeWatcherProperties(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 WatcherData( + 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(WatcherData)} does not support writing '{options.Format}' format."); + } + } + + WatcherData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWatcherData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WatcherData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.cs new file mode 100644 index 000000000000..db4ed0ffd517 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherData.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 Watcher data model. + /// The DatabaseWatcherProviderHub resource. + /// + public partial class WatcherData : 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 WatcherData(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 WatcherData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, WatcherProperties 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 WatcherData() + { + } + + /// The resource-specific properties for this resource. + public WatcherProperties 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/WatcherResource.Serialization.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.Serialization.cs new file mode 100644 index 000000000000..3d31f027fcdd --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.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 WatcherResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + WatcherData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + WatcherData 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/WatcherResource.cs b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.cs new file mode 100644 index 000000000000..7b83019f45da --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/src/Generated/WatcherResource.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 Watcher 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 GetWatcherResource method. + /// Otherwise you can get one from its parent resource using the GetWatcher method. + /// + public partial class WatcherResource : 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 _watcherClientDiagnostics; + private readonly WatchersRestOperations _watcherRestClient; + private readonly WatcherData _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 WatcherResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WatcherResource(ArmClient client, WatcherData 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 WatcherResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _watcherClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.DatabaseWatcher", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string watcherApiVersion); + _watcherRestClient = new WatchersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, watcherApiVersion); +#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 WatcherData 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 AlertRuleResources in the Watcher. + /// An object representing collection of AlertRuleResources and their operations over a AlertRuleResource. + public virtual AlertRuleResourceCollection GetAlertRuleResources() + { + return GetCachedClient(client => new AlertRuleResourceCollection(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> GetAlertRuleResourceAsync(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + return await GetAlertRuleResources().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 GetAlertRuleResource(string alertRuleResourceName, CancellationToken cancellationToken = default) + { + return GetAlertRuleResources().Get(alertRuleResourceName, cancellationToken); + } + + /// Gets a collection of HealthValidationResources in the Watcher. + /// An object representing collection of HealthValidationResources and their operations over a HealthValidationResource. + public virtual HealthValidationCollection GetHealthValidations() + { + return GetCachedClient(client => new HealthValidationCollection(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> GetHealthValidationAsync(string healthValidationName, CancellationToken cancellationToken = default) + { + return await GetHealthValidations().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 GetHealthValidation(string healthValidationName, CancellationToken cancellationToken = default) + { + return GetHealthValidations().Get(healthValidationName, cancellationToken); + } + + /// Gets a collection of TargetResources in the Watcher. + /// An object representing collection of TargetResources and their operations over a TargetResource. + public virtual TargetCollection GetTargets() + { + return GetCachedClient(client => new TargetCollection(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> GetTargetAsync(string targetName, CancellationToken cancellationToken = default) + { + return await GetTargets().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 GetTarget(string targetName, CancellationToken cancellationToken = default) + { + return GetTargets().Get(targetName, cancellationToken); + } + + /// Gets a collection of SharedPrivateLinkResources in the Watcher. + /// An object representing collection of SharedPrivateLinkResources and their operations over a SharedPrivateLinkResource. + public virtual SharedPrivateLinkResourceCollection GetSharedPrivateLinkResources() + { + return GetCachedClient(client => new SharedPrivateLinkResourceCollection(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> GetSharedPrivateLinkResourceAsync(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + return await GetSharedPrivateLinkResources().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 GetSharedPrivateLinkResource(string sharedPrivateLinkResourceName, CancellationToken cancellationToken = default) + { + return GetSharedPrivateLinkResources().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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Get"); + scope.Start(); + try + { + var response = await _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Get"); + scope.Start(); + try + { + var response = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WatcherResource(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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Delete"); + scope.Start(); + try + { + var response = await _watcherRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Delete"); + scope.Start(); + try + { + var response = _watcherRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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, WatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _watcherClientDiagnostics.CreateScope("WatcherResource.Update"); + scope.Start(); + try + { + var response = await _watcherRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(new WatcherOperationSource(Client), _watcherClientDiagnostics, Pipeline, _watcherRestClient.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, WatcherPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _watcherClientDiagnostics.CreateScope("WatcherResource.Update"); + scope.Start(); + try + { + var response = _watcherRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new DatabaseWatcherArmOperation(new WatcherOperationSource(Client), _watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Start"); + scope.Start(); + try + { + var response = await _watcherRestClient.StartAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Start"); + scope.Start(); + try + { + var response = _watcherRestClient.Start(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Stop"); + scope.Start(); + try + { + var response = await _watcherRestClient.StopAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.Stop"); + scope.Start(); + try + { + var response = _watcherRestClient.Stop(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DatabaseWatcherArmOperation(_watcherClientDiagnostics, Pipeline, _watcherRestClient.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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new WatcherPatch(); + 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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new WatcherPatch(); + 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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new WatcherPatch(); + 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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new WatcherPatch(); + 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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 _watcherRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new WatcherPatch(); + 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 = _watcherClientDiagnostics.CreateScope("WatcherResource.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 = _watcherRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new WatcherResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new WatcherPatch(); + 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/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..2270a3190f06 --- /dev/null +++ b/sdk/databasewatcher/Azure.ResourceManager.DatabaseWatcher/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/databasewatcher/DatabaseWatcher.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +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/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml index d39a7fa40086..8f7dafa97976 100644 --- a/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml +++ b/sdk/deviceregistry/Azure.ResourceManager.DeviceRegistry/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification\deviceregistry\DeviceRegistry.Management -commit: df7c9b730f08e00dbe543b57235b36666563ff7d +directory: specification/deviceregistry/DeviceRegistry.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.net8.0.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.net8.0.cs index 86448afdc637..257cbf40ba48 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.net8.0.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.net8.0.cs @@ -2,6 +2,8 @@ namespace Azure.ResourceManager.DevOpsInfrastructure { public static partial class DevOpsInfrastructureExtensions { + public static Azure.Response CheckNameAvailabilityPool(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckNameAvailabilityPoolAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetDevOpsPool(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetDevOpsPoolAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.DevOpsPoolResource GetDevOpsPoolResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -91,6 +93,8 @@ protected MockableDevOpsInfrastructureResourceGroupResource() { } public partial class MockableDevOpsInfrastructureSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockableDevOpsInfrastructureSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityPool(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityPoolAsync(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDevOpsPools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDevOpsPoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetSkusByLocation(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -103,6 +107,7 @@ namespace Azure.ResourceManager.DevOpsInfrastructure.Models { public static partial class ArmDevOpsInfrastructureModelFactory { + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityResult CheckNameAvailabilityResult(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus available = default(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus), string message = null, string name = null, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason reason = default(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason)) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsImageVersion DevOpsImageVersion(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string imageVersion = null) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.DevOpsPoolData DevOpsPoolData(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.DevOpsInfrastructure.Models.DevOpsPoolProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsResourceDetails DevOpsResourceDetails(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsResourceDetailsProperties properties = null) { throw null; } @@ -128,6 +133,86 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AvailabilityStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AvailabilityStatus(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Available { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Unavailable { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus 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.DevOpsInfrastructure.Models.AvailabilityStatus left, Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus left, Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CertificateStoreNameOption : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CertificateStoreNameOption(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption My { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption Root { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption 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.DevOpsInfrastructure.Models.CertificateStoreNameOption left, Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption left, Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailability : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CheckNameAvailability(string name, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType type) { } + public string Name { get { throw null; } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability 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.DevOpsInfrastructure.Models.CheckNameAvailability 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 CheckNameAvailabilityReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CheckNameAvailabilityReason(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason 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.DevOpsInfrastructure.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CheckNameAvailabilityResult() { } + public Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Available { get { throw null; } } + public string Message { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityResult 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.DevOpsInfrastructure.Models.CheckNameAvailabilityResult 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 DevOpsAzureOrganizationProfile : Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsOrganizationProfile, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevOpsAzureOrganizationProfile(System.Collections.Generic.IEnumerable organizations) { } @@ -284,6 +369,23 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevOpsInfrastructureResourceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevOpsInfrastructureResourceType(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType MicrosoftDevOpsInfrastructurePools { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType 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.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType left, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType left, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DevOpsLogonType : System.IEquatable { private readonly object _dummy; @@ -304,6 +406,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevOpsOrganization : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevOpsOrganization(System.Uri uri) { } + public bool? OpenAccess { get { throw null; } set { } } public int? Parallelism { get { throw null; } set { } } public System.Collections.Generic.IList Projects { get { throw null; } } public System.Uri Uri { get { throw null; } set { } } @@ -382,6 +485,7 @@ public partial class DevOpsPoolVmImage : System.ClientModel.Primitives.IJsonMode public DevOpsPoolVmImage() { } public System.Collections.Generic.IList Aliases { get { throw null; } } public string Buffer { get { throw null; } set { } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType? EphemeralType { get { throw null; } set { } } public string ResourceId { get { throw null; } set { } } public string WellKnownImageName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -568,6 +672,25 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EphemeralType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EphemeralType(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType Automatic { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType CacheDisk { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType ResourceDisk { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType 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.DevOpsInfrastructure.Models.EphemeralType left, Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType left, Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType right) { throw null; } + public override string ToString() { throw null; } + } public partial class ManualResourcePredictionsProfile : Azure.ResourceManager.DevOpsInfrastructure.Models.ResourcePredictionsProfile, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ManualResourcePredictionsProfile() { } @@ -757,6 +880,7 @@ public partial class SecretsManagementSettings : System.ClientModel.Primitives.I { public SecretsManagementSettings(System.Collections.Generic.IEnumerable observedCertificates, bool keyExportable) { } public string CertificateStoreLocation { get { throw null; } set { } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption? CertificateStoreName { get { throw null; } set { } } public bool KeyExportable { get { throw null; } set { } } public System.Collections.Generic.IList ObservedCertificates { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.netstandard2.0.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.netstandard2.0.cs index 86448afdc637..257cbf40ba48 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.netstandard2.0.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/api/Azure.ResourceManager.DevOpsInfrastructure.netstandard2.0.cs @@ -2,6 +2,8 @@ namespace Azure.ResourceManager.DevOpsInfrastructure { public static partial class DevOpsInfrastructureExtensions { + public static Azure.Response CheckNameAvailabilityPool(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CheckNameAvailabilityPoolAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetDevOpsPool(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetDevOpsPoolAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string poolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.DevOpsPoolResource GetDevOpsPoolResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } @@ -91,6 +93,8 @@ protected MockableDevOpsInfrastructureResourceGroupResource() { } public partial class MockableDevOpsInfrastructureSubscriptionResource : Azure.ResourceManager.ArmResource { protected MockableDevOpsInfrastructureSubscriptionResource() { } + public virtual Azure.Response CheckNameAvailabilityPool(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckNameAvailabilityPoolAsync(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability body, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetDevOpsPools(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable GetDevOpsPoolsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable GetSkusByLocation(string locationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -103,6 +107,7 @@ namespace Azure.ResourceManager.DevOpsInfrastructure.Models { public static partial class ArmDevOpsInfrastructureModelFactory { + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityResult CheckNameAvailabilityResult(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus available = default(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus), string message = null, string name = null, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason reason = default(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason)) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsImageVersion DevOpsImageVersion(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string imageVersion = null) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.DevOpsPoolData DevOpsPoolData(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.DevOpsInfrastructure.Models.DevOpsPoolProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsResourceDetails DevOpsResourceDetails(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsResourceDetailsProperties properties = null) { throw null; } @@ -128,6 +133,86 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AvailabilityStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AvailabilityStatus(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Available { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Unavailable { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus 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.DevOpsInfrastructure.Models.AvailabilityStatus left, Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus left, Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct CertificateStoreNameOption : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CertificateStoreNameOption(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption My { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption Root { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption 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.DevOpsInfrastructure.Models.CertificateStoreNameOption left, Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption left, Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailability : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CheckNameAvailability(string name, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType type) { } + public string Name { get { throw null; } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailability 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.DevOpsInfrastructure.Models.CheckNameAvailability 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 CheckNameAvailabilityReason : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public CheckNameAvailabilityReason(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason AlreadyExists { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason Invalid { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason 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.DevOpsInfrastructure.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason left, Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason right) { throw null; } + public override string ToString() { throw null; } + } + public partial class CheckNameAvailabilityResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal CheckNameAvailabilityResult() { } + public Azure.ResourceManager.DevOpsInfrastructure.Models.AvailabilityStatus Available { get { throw null; } } + public string Message { get { throw null; } } + public string Name { get { throw null; } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityReason Reason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.DevOpsInfrastructure.Models.CheckNameAvailabilityResult 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.DevOpsInfrastructure.Models.CheckNameAvailabilityResult 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 DevOpsAzureOrganizationProfile : Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsOrganizationProfile, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevOpsAzureOrganizationProfile(System.Collections.Generic.IEnumerable organizations) { } @@ -284,6 +369,23 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public override string ToString() { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DevOpsInfrastructureResourceType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DevOpsInfrastructureResourceType(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType MicrosoftDevOpsInfrastructurePools { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType 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.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType left, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType left, Azure.ResourceManager.DevOpsInfrastructure.Models.DevOpsInfrastructureResourceType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct DevOpsLogonType : System.IEquatable { private readonly object _dummy; @@ -304,6 +406,7 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write public partial class DevOpsOrganization : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public DevOpsOrganization(System.Uri uri) { } + public bool? OpenAccess { get { throw null; } set { } } public int? Parallelism { get { throw null; } set { } } public System.Collections.Generic.IList Projects { get { throw null; } } public System.Uri Uri { get { throw null; } set { } } @@ -382,6 +485,7 @@ public partial class DevOpsPoolVmImage : System.ClientModel.Primitives.IJsonMode public DevOpsPoolVmImage() { } public System.Collections.Generic.IList Aliases { get { throw null; } } public string Buffer { get { throw null; } set { } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType? EphemeralType { get { throw null; } set { } } public string ResourceId { get { throw null; } set { } } public string WellKnownImageName { get { throw null; } set { } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } @@ -568,6 +672,25 @@ protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter write string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EphemeralType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EphemeralType(string value) { throw null; } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType Automatic { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType CacheDisk { get { throw null; } } + public static Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType ResourceDisk { get { throw null; } } + public bool Equals(Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType 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.DevOpsInfrastructure.Models.EphemeralType left, Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType right) { throw null; } + public static implicit operator Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType left, Azure.ResourceManager.DevOpsInfrastructure.Models.EphemeralType right) { throw null; } + public override string ToString() { throw null; } + } public partial class ManualResourcePredictionsProfile : Azure.ResourceManager.DevOpsInfrastructure.Models.ResourcePredictionsProfile, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ManualResourcePredictionsProfile() { } @@ -757,6 +880,7 @@ public partial class SecretsManagementSettings : System.ClientModel.Primitives.I { public SecretsManagementSettings(System.Collections.Generic.IEnumerable observedCertificates, bool keyExportable) { } public string CertificateStoreLocation { get { throw null; } set { } } + public Azure.ResourceManager.DevOpsInfrastructure.Models.CertificateStoreNameOption? CertificateStoreName { get { throw null; } set { } } public bool KeyExportable { get { throw null; } set { } } public System.Collections.Generic.IList ObservedCertificates { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolCollection.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolCollection.cs index c380856cbc2a..5a0bb2ef594f 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolCollection.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_DevOpsPoolCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_PoolsCreateOrUpdate() { - // Generated from example definition: 2024-10-19/CreateOrUpdatePool.json + // Generated from example definition: 2025-01-21/CreateOrUpdatePool.json // this example is just showing the usage of "Pool_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 @@ -46,13 +46,26 @@ public async Task CreateOrUpdate_PoolsCreateOrUpdate() Properties = new DevOpsPoolProperties(10, new DevOpsAzureOrganizationProfile(new DevOpsOrganization[] { new DevOpsOrganization(new Uri("https://mseng.visualstudio.com")) +{ +OpenAccess = true, +} }), new DevOpsStatelessAgentProfile(), new DevOpsVmssFabricProfile(new DevOpsAzureSku("Standard_D4ads_v5"), new DevOpsPoolVmImage[] { new DevOpsPoolVmImage { ResourceId = "/MicrosoftWindowsServer/WindowsServer/2019-Datacenter/latest", +EphemeralType = EphemeralType.Automatic, } - }), "/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES") + }) + { + OSProfile = new DevOpsOSProfile + { + SecretsManagementSettings = new SecretsManagementSettings(new Uri[] { new Uri("https://abc.vault.azure.net/secrets/one") }, false) + { + CertificateStoreName = CertificateStoreNameOption.Root, + }, + }, + }, "/subscriptions/222e81d0-cf38-4dab-baa5-289bf16baaa4/resourceGroups/rg-1es-devcenter/providers/Microsoft.DevCenter/projects/1ES") { ProvisioningState = DevOpsInfrastructureProvisioningState.Succeeded, }, @@ -71,7 +84,7 @@ public async Task CreateOrUpdate_PoolsCreateOrUpdate() [Ignore("Only validating compilation of examples")] public async Task Get_PoolsGet() { - // Generated from example definition: 2024-10-19/GetPool.json + // Generated from example definition: 2025-01-21/GetPool.json // this example is just showing the usage of "Pool_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 @@ -104,7 +117,7 @@ public async Task Get_PoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetAll_PoolsListByResourceGroup() { - // Generated from example definition: 2024-10-19/ListPoolsBySubscriptionAndResourceGroup.json + // Generated from example definition: 2025-01-21/ListPoolsBySubscriptionAndResourceGroup.json // this example is just showing the usage of "Pool_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 @@ -139,7 +152,7 @@ public async Task GetAll_PoolsListByResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_PoolsGet() { - // Generated from example definition: 2024-10-19/GetPool.json + // Generated from example definition: 2025-01-21/GetPool.json // this example is just showing the usage of "Pool_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 @@ -168,7 +181,7 @@ public async Task Exists_PoolsGet() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_PoolsGet() { - // Generated from example definition: 2024-10-19/GetPool.json + // Generated from example definition: 2025-01-21/GetPool.json // this example is just showing the usage of "Pool_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolResource.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolResource.cs index a4b685804527..35b6bc86998c 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolResource.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_DevOpsPoolResource.cs @@ -20,7 +20,7 @@ public partial class Sample_DevOpsPoolResource [Ignore("Only validating compilation of examples")] public async Task Get_PoolsGet() { - // Generated from example definition: 2024-10-19/GetPool.json + // Generated from example definition: 2025-01-21/GetPool.json // this example is just showing the usage of "Pool_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_PoolsGet() [Ignore("Only validating compilation of examples")] public async Task Delete_PoolsDelete() { - // Generated from example definition: 2024-10-19/DeletePool.json + // Generated from example definition: 2025-01-21/DeletePool.json // this example is just showing the usage of "Pool_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,7 +76,7 @@ public async Task Delete_PoolsDelete() [Ignore("Only validating compilation of examples")] public async Task Update_PoolsUpdate() { - // Generated from example definition: 2024-10-19/UpdatePool.json + // Generated from example definition: 2025-01-21/UpdatePool.json // this example is just showing the usage of "Pool_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 @@ -108,7 +108,7 @@ public async Task Update_PoolsUpdate() [Ignore("Only validating compilation of examples")] public async Task GetResourceDetails_ResourceDetailsListByPool() { - // Generated from example definition: 2024-10-19/ResourceDetails_ListByPool.json + // Generated from example definition: 2025-01-21/ResourceDetails_ListByPool.json // this example is just showing the usage of "ResourceDetailsObject_ListByPool" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index b3f54cb97955..812ebf638b70 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_ResourceGroupResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetImageVersionsByImage_ImageVersionsListByImage() { - // Generated from example definition: 2024-10-19/ImageVersions_ListByImage.json + // Generated from example definition: 2025-01-21/ImageVersions_ListByImage.json // this example is just showing the usage of "ImageVersion_ListByImage" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 97546467a4f7..bf121c2d49c4 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetDevOpsPools_PoolsListBySubscription() { - // Generated from example definition: 2024-10-19/ListPoolsBySubscription.json + // Generated from example definition: 2025-01-21/ListPoolsBySubscription.json // this example is just showing the usage of "Pool_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 @@ -48,11 +48,36 @@ public async Task GetDevOpsPools_PoolsListBySubscription() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CheckNameAvailabilityPool_PoolsCheckNameAvailability() + { + // Generated from example definition: 2025-01-21/Pools_CheckNameAvailability.json + // this example is just showing the usage of "Pools_CheckNameAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 = "a2e95d27-c161-4b61-bda4-11512c14c2c2"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + CheckNameAvailability body = new CheckNameAvailability("mydevopspool", DevOpsInfrastructureResourceType.MicrosoftDevOpsInfrastructurePools); + CheckNameAvailabilityResult result = await subscriptionResource.CheckNameAvailabilityPoolAsync(body); + + Console.WriteLine($"Succeeded: {result}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task GetSkusByLocation_SkuListByLocation() { - // Generated from example definition: 2024-10-19/Sku_ListByLocation.json + // Generated from example definition: 2025-01-21/Sku_ListByLocation.json // this example is just showing the usage of "ResourceSku_ListByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +105,7 @@ public async Task GetSkusByLocation_SkuListByLocation() [Ignore("Only validating compilation of examples")] public async Task GetUsages_SubscriptionUsagesUsages() { - // Generated from example definition: 2024-10-19/SubscriptionUsages_Usages.json + // Generated from example definition: 2025-01-21/SubscriptionUsages_Usages.json // this example is just showing the usage of "SubscriptionUsages_GetUsages" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/ArmDevOpsInfrastructureModelFactory.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/ArmDevOpsInfrastructureModelFactory.cs index b6121565a165..06c09857f702 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/ArmDevOpsInfrastructureModelFactory.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/ArmDevOpsInfrastructureModelFactory.cs @@ -220,5 +220,16 @@ public static DevOpsPoolData DevOpsPoolData(ResourceIdentifier id = null, string identity, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// Availability status of the name. + /// A message explaining why the name is unavailable. Will be null if the name is available. + /// The name whose availability was checked. + /// The reason code explaining why the name is unavailable. Will be null if the name is available. + /// A new instance for mocking. + public static CheckNameAvailabilityResult CheckNameAvailabilityResult(AvailabilityStatus available = default, string message = null, string name = null, CheckNameAvailabilityReason reason = default) + { + return new CheckNameAvailabilityResult(available, message, name, reason, serializedAdditionalRawData: null); + } } } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolCollection.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolCollection.cs index 1e2ea411a868..7373fd2c720c 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolCollection.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAsync( /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUnt /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string poolName /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string poolName, CancellationTok /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken c /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancellatio /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string poolName, Cancellat /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string poolName, CancellationToken cancella /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExistsAsync /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolResource.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolResource.cs index a3b6aeebb638..cd7b24c30bf8 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolResource.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/DevOpsPoolResource.cs @@ -108,7 +108,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -148,7 +148,7 @@ public virtual async Task> GetAsync(CancellationTok /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -188,7 +188,7 @@ public virtual Response Get(CancellationToken cancellationTo /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -230,7 +230,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -272,7 +272,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -318,7 +318,7 @@ public virtual async Task> UpdateAsync(WaitUnti /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -364,7 +364,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, DevO /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -390,7 +390,7 @@ public virtual AsyncPageable GetResourceDetailsAsync(Canc /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -416,7 +416,7 @@ public virtual Pageable GetResourceDetails(CancellationTo /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -478,7 +478,7 @@ public virtual async Task> AddTagAsync(string key, /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -540,7 +540,7 @@ public virtual Response AddTag(string key, string value, Can /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -597,7 +597,7 @@ public virtual async Task> SetTagsAsync(IDictionary /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -654,7 +654,7 @@ public virtual Response SetTags(IDictionary /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -714,7 +714,7 @@ public virtual async Task> RemoveTagAsync(string ke /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/DevOpsInfrastructureExtensions.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/DevOpsInfrastructureExtensions.cs index 3e3e44d9dcd3..a85b1cb206f9 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/DevOpsInfrastructureExtensions.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/DevOpsInfrastructureExtensions.cs @@ -82,7 +82,7 @@ public static DevOpsPoolCollection GetDevOpsPools(this ResourceGroupResource res /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -120,7 +120,7 @@ public static async Task> GetDevOpsPoolAsync(this R /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -158,7 +158,7 @@ public static Response GetDevOpsPool(this ResourceGroupResou /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -192,7 +192,7 @@ public static AsyncPageable GetImageVersionsByImageAsync(thi /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -226,7 +226,7 @@ public static Pageable GetImageVersionsByImage(this Resource /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -262,7 +262,7 @@ public static AsyncPageable GetDevOpsPoolsAsync(this Subscri /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -285,6 +285,78 @@ public static Pageable GetDevOpsPools(this SubscriptionResou return GetMockableDevOpsInfrastructureSubscriptionResource(subscriptionResource).GetDevOpsPools(cancellationToken); } + /// + /// Checks that the pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability + /// + /// + /// Operation Id + /// Pools_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2025-01-21 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static async Task> CheckNameAvailabilityPoolAsync(this SubscriptionResource subscriptionResource, CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableDevOpsInfrastructureSubscriptionResource(subscriptionResource).CheckNameAvailabilityPoolAsync(body, cancellationToken).ConfigureAwait(false); + } + + /// + /// Checks that the pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability + /// + /// + /// Operation Id + /// Pools_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2025-01-21 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + public static Response CheckNameAvailabilityPool(this SubscriptionResource subscriptionResource, CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableDevOpsInfrastructureSubscriptionResource(subscriptionResource).CheckNameAvailabilityPool(body, cancellationToken); + } + /// /// List ResourceSku resources by subscription ID /// @@ -298,7 +370,7 @@ public static Pageable GetDevOpsPools(this SubscriptionResou /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -332,7 +404,7 @@ public static AsyncPageable GetSkusByLocationAsync(this Subsc /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -366,7 +438,7 @@ public static Pageable GetSkusByLocation(this SubscriptionRes /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -399,7 +471,7 @@ public static AsyncPageable GetUsagesAsync(this Subscriptio /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureResourceGroupResource.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureResourceGroupResource.cs index fbfc1fee6226..f5787074c63d 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureResourceGroupResource.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureResourceGroupResource.cs @@ -62,7 +62,7 @@ public virtual DevOpsPoolCollection GetDevOpsPools() /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -93,7 +93,7 @@ public virtual async Task> GetDevOpsPoolAsync(strin /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -124,7 +124,7 @@ public virtual Response GetDevOpsPool(string poolName, Cance /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -155,7 +155,7 @@ public virtual AsyncPageable GetImageVersionsByImageAsync(st /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureSubscriptionResource.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureSubscriptionResource.cs index 224f919ee0d4..f8f46cdffa0e 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureSubscriptionResource.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Extensions/MockableDevOpsInfrastructureSubscriptionResource.cs @@ -7,6 +7,7 @@ using System; using System.Threading; +using System.Threading.Tasks; using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; @@ -62,7 +63,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -92,7 +93,7 @@ public virtual AsyncPageable GetDevOpsPoolsAsync(Cancellatio /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// Resource @@ -109,6 +110,90 @@ public virtual Pageable GetDevOpsPools(CancellationToken can return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DevOpsPoolResource(Client, DevOpsPoolData.DeserializeDevOpsPoolData(e)), DevOpsPoolPoolsClientDiagnostics, Pipeline, "MockableDevOpsInfrastructureSubscriptionResource.GetDevOpsPools", "value", "nextLink", cancellationToken); } + /// + /// Checks that the pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability + /// + /// + /// Operation Id + /// Pools_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2025-01-21 + /// + /// + /// Resource + /// + /// + /// + /// + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual async Task> CheckNameAvailabilityPoolAsync(CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = DevOpsPoolPoolsClientDiagnostics.CreateScope("MockableDevOpsInfrastructureSubscriptionResource.CheckNameAvailabilityPool"); + scope.Start(); + try + { + var response = await DevOpsPoolPoolsRestClient.CheckNameAvailabilityAsync(Id.SubscriptionId, body, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks that the pool name is valid and is not already in use. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability + /// + /// + /// Operation Id + /// Pools_CheckNameAvailability + /// + /// + /// Default Api Version + /// 2025-01-21 + /// + /// + /// Resource + /// + /// + /// + /// + /// The CheckAvailability request. + /// The cancellation token to use. + /// is null. + public virtual Response CheckNameAvailabilityPool(CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using var scope = DevOpsPoolPoolsClientDiagnostics.CreateScope("MockableDevOpsInfrastructureSubscriptionResource.CheckNameAvailabilityPool"); + scope.Start(); + try + { + var response = DevOpsPoolPoolsRestClient.CheckNameAvailability(Id.SubscriptionId, body, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// List ResourceSku resources by subscription ID /// @@ -122,7 +207,7 @@ public virtual Pageable GetDevOpsPools(CancellationToken can /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -153,7 +238,7 @@ public virtual AsyncPageable GetSkusByLocationAsync(string lo /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -184,7 +269,7 @@ public virtual Pageable GetSkusByLocation(string locationName /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// @@ -211,7 +296,7 @@ public virtual AsyncPageable GetUsagesAsync(AzureLocation l /// /// /// Default Api Version - /// 2024-10-19 + /// 2025-01-21 /// /// /// diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/AvailabilityStatus.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/AvailabilityStatus.cs new file mode 100644 index 000000000000..6d18aa34fb56 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/AvailabilityStatus.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.DevOpsInfrastructure.Models +{ + /// AvailabilityStatus of a name. + public readonly partial struct AvailabilityStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AvailabilityStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvailableValue = "Available"; + private const string UnavailableValue = "Unavailable"; + + /// The name is available. + public static AvailabilityStatus Available { get; } = new AvailabilityStatus(AvailableValue); + /// The name is unavailable. + public static AvailabilityStatus Unavailable { get; } = new AvailabilityStatus(UnavailableValue); + /// Determines if two values are the same. + public static bool operator ==(AvailabilityStatus left, AvailabilityStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AvailabilityStatus left, AvailabilityStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AvailabilityStatus(string value) => new AvailabilityStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvailabilityStatus other && Equals(other); + /// + public bool Equals(AvailabilityStatus 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/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CertificateStoreNameOption.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CertificateStoreNameOption.cs new file mode 100644 index 000000000000..5027fb886be1 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CertificateStoreNameOption.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.DevOpsInfrastructure.Models +{ + /// The certificate store name type. + public readonly partial struct CertificateStoreNameOption : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CertificateStoreNameOption(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MyValue = "My"; + private const string RootValue = "Root"; + + /// The X.509 certificate store for personal certificates. + public static CertificateStoreNameOption My { get; } = new CertificateStoreNameOption(MyValue); + /// The X.509 certificate store for trusted root certificate authorities (CAs). + public static CertificateStoreNameOption Root { get; } = new CertificateStoreNameOption(RootValue); + /// Determines if two values are the same. + public static bool operator ==(CertificateStoreNameOption left, CertificateStoreNameOption right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CertificateStoreNameOption left, CertificateStoreNameOption right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CertificateStoreNameOption(string value) => new CertificateStoreNameOption(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CertificateStoreNameOption other && Equals(other); + /// + public bool Equals(CertificateStoreNameOption 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/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.Serialization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.Serialization.cs new file mode 100644 index 000000000000..1abe69fc8230 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.DevOpsInfrastructure.Models +{ + public partial class CheckNameAvailability : 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(CheckNameAvailability)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CheckNameAvailability 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(CheckNameAvailability)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailability(document.RootElement, options); + } + + internal static CheckNameAvailability DeserializeCheckNameAvailability(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + DevOpsInfrastructureResourceType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new DevOpsInfrastructureResourceType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CheckNameAvailability(name, type, 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(CheckNameAvailability)} does not support writing '{options.Format}' format."); + } + } + + CheckNameAvailability IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCheckNameAvailability(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckNameAvailability)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.cs new file mode 100644 index 000000000000..62c886d554e5 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailability.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevOpsInfrastructure.Models +{ + /// The parameters used to check the availability of a resource. + public partial class CheckNameAvailability + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the resource. + /// The type of resource that is used as the scope of the availability check. + /// is null. + public CheckNameAvailability(string name, DevOpsInfrastructureResourceType type) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + Type = type; + } + + /// Initializes a new instance of . + /// The name of the resource. + /// The type of resource that is used as the scope of the availability check. + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailability(string name, DevOpsInfrastructureResourceType type, IDictionary serializedAdditionalRawData) + { + Name = name; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CheckNameAvailability() + { + } + + /// The name of the resource. + public string Name { get; } + /// The type of resource that is used as the scope of the availability check. + public DevOpsInfrastructureResourceType Type { get; } + } +} diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityReason.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityReason.cs new file mode 100644 index 000000000000..4f0bf5b350a3 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityReason.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.DevOpsInfrastructure.Models +{ + /// The reason code explaining why the name is unavailable. Will be null if the name is available. + public readonly partial struct CheckNameAvailabilityReason : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public CheckNameAvailabilityReason(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InvalidValue = "Invalid"; + private const string AlreadyExistsValue = "AlreadyExists"; + + /// The name is invalid. + public static CheckNameAvailabilityReason Invalid { get; } = new CheckNameAvailabilityReason(InvalidValue); + /// The name already exists. + public static CheckNameAvailabilityReason AlreadyExists { get; } = new CheckNameAvailabilityReason(AlreadyExistsValue); + /// Determines if two values are the same. + public static bool operator ==(CheckNameAvailabilityReason left, CheckNameAvailabilityReason right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(CheckNameAvailabilityReason left, CheckNameAvailabilityReason right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator CheckNameAvailabilityReason(string value) => new CheckNameAvailabilityReason(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is CheckNameAvailabilityReason other && Equals(other); + /// + public bool Equals(CheckNameAvailabilityReason 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/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs new file mode 100644 index 000000000000..a0da8928d23a --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.Serialization.cs @@ -0,0 +1,150 @@ +// 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.DevOpsInfrastructure.Models +{ + public partial class CheckNameAvailabilityResult : 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(CheckNameAvailabilityResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("available"u8); + writer.WriteStringValue(Available.ToString()); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CheckNameAvailabilityResult 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(CheckNameAvailabilityResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCheckNameAvailabilityResult(document.RootElement, options); + } + + internal static CheckNameAvailabilityResult DeserializeCheckNameAvailabilityResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AvailabilityStatus available = default; + string message = default; + string name = default; + CheckNameAvailabilityReason reason = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("available"u8)) + { + available = new AvailabilityStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = new CheckNameAvailabilityReason(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CheckNameAvailabilityResult(available, message, name, reason, 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(CheckNameAvailabilityResult)} does not support writing '{options.Format}' format."); + } + } + + CheckNameAvailabilityResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCheckNameAvailabilityResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CheckNameAvailabilityResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.cs new file mode 100644 index 000000000000..e41317ea87be --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/CheckNameAvailabilityResult.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.DevOpsInfrastructure.Models +{ + /// The CheckNameAvailability operation response. + public partial class CheckNameAvailabilityResult + { + /// + /// 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 . + /// Availability status of the name. + /// A message explaining why the name is unavailable. Will be null if the name is available. + /// The name whose availability was checked. + /// The reason code explaining why the name is unavailable. Will be null if the name is available. + /// or is null. + internal CheckNameAvailabilityResult(AvailabilityStatus available, string message, string name, CheckNameAvailabilityReason reason) + { + Argument.AssertNotNull(message, nameof(message)); + Argument.AssertNotNull(name, nameof(name)); + + Available = available; + Message = message; + Name = name; + Reason = reason; + } + + /// Initializes a new instance of . + /// Availability status of the name. + /// A message explaining why the name is unavailable. Will be null if the name is available. + /// The name whose availability was checked. + /// The reason code explaining why the name is unavailable. Will be null if the name is available. + /// Keeps track of any properties unknown to the library. + internal CheckNameAvailabilityResult(AvailabilityStatus available, string message, string name, CheckNameAvailabilityReason reason, IDictionary serializedAdditionalRawData) + { + Available = available; + Message = message; + Name = name; + Reason = reason; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CheckNameAvailabilityResult() + { + } + + /// Availability status of the name. + public AvailabilityStatus Available { get; } + /// A message explaining why the name is unavailable. Will be null if the name is available. + public string Message { get; } + /// The name whose availability was checked. + public string Name { get; } + /// The reason code explaining why the name is unavailable. Will be null if the name is available. + public CheckNameAvailabilityReason Reason { get; } + } +} diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsInfrastructureResourceType.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsInfrastructureResourceType.cs new file mode 100644 index 000000000000..6579f2c59af9 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsInfrastructureResourceType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.DevOpsInfrastructure.Models +{ + /// The type of resource. + public readonly partial struct DevOpsInfrastructureResourceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DevOpsInfrastructureResourceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MicrosoftDevOpsInfrastructurePoolsValue = "Microsoft.DevOpsInfrastructure/pools"; + + /// DevOpsInfrastructure pool resource. + public static DevOpsInfrastructureResourceType MicrosoftDevOpsInfrastructurePools { get; } = new DevOpsInfrastructureResourceType(MicrosoftDevOpsInfrastructurePoolsValue); + /// Determines if two values are the same. + public static bool operator ==(DevOpsInfrastructureResourceType left, DevOpsInfrastructureResourceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DevOpsInfrastructureResourceType left, DevOpsInfrastructureResourceType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DevOpsInfrastructureResourceType(string value) => new DevOpsInfrastructureResourceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DevOpsInfrastructureResourceType other && Equals(other); + /// + public bool Equals(DevOpsInfrastructureResourceType 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/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.Serialization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.Serialization.cs index c5fe16dff19b..6e8c4378894c 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.Serialization.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.Serialization.cs @@ -51,6 +51,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("parallelism"u8); writer.WriteNumberValue(Parallelism.Value); } + if (Optional.IsDefined(OpenAccess)) + { + writer.WritePropertyName("openAccess"u8); + writer.WriteBooleanValue(OpenAccess.Value); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -91,6 +96,7 @@ internal static DevOpsOrganization DeserializeDevOpsOrganization(JsonElement ele Uri url = default; IList projects = default; int? parallelism = default; + bool? openAccess = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -123,13 +129,22 @@ internal static DevOpsOrganization DeserializeDevOpsOrganization(JsonElement ele parallelism = property.Value.GetInt32(); continue; } + if (property.NameEquals("openAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + openAccess = property.Value.GetBoolean(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new DevOpsOrganization(url, projects ?? new ChangeTrackingList(), parallelism, serializedAdditionalRawData); + return new DevOpsOrganization(url, projects ?? new ChangeTrackingList(), parallelism, openAccess, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.cs index c811965dd068..0452f359220f 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsOrganization.cs @@ -60,12 +60,14 @@ public DevOpsOrganization(Uri uri) /// The Azure DevOps organization URL in which the pool should be created. /// Optional list of projects in which the pool should be created. /// How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool. + /// Determines if the pool should have open access to all projects in this organization. /// Keeps track of any properties unknown to the library. - internal DevOpsOrganization(Uri uri, IList projects, int? parallelism, IDictionary serializedAdditionalRawData) + internal DevOpsOrganization(Uri uri, IList projects, int? parallelism, bool? openAccess, IDictionary serializedAdditionalRawData) { Uri = uri; Projects = projects; Parallelism = parallelism; + OpenAccess = openAccess; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -80,5 +82,7 @@ internal DevOpsOrganization() public IList Projects { get; } /// How many machines can be created at maximum in this organization out of the maximumConcurrency of the pool. public int? Parallelism { get; set; } + /// Determines if the pool should have open access to all projects in this organization. + public bool? OpenAccess { get; set; } } } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.Serialization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.Serialization.cs index 899cb9091b97..e16abc1a6754 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.Serialization.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.Serialization.cs @@ -59,6 +59,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("buffer"u8); writer.WriteStringValue(Buffer); } + if (Optional.IsDefined(EphemeralType)) + { + writer.WritePropertyName("ephemeralType"u8); + writer.WriteStringValue(EphemeralType.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -100,6 +105,7 @@ internal static DevOpsPoolVmImage DeserializeDevOpsPoolVmImage(JsonElement eleme string wellKnownImageName = default; IList aliases = default; string buffer = default; + EphemeralType? ephemeralType = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -133,13 +139,28 @@ internal static DevOpsPoolVmImage DeserializeDevOpsPoolVmImage(JsonElement eleme buffer = property.Value.GetString(); continue; } + if (property.NameEquals("ephemeralType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ephemeralType = new EphemeralType(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new DevOpsPoolVmImage(resourceId, wellKnownImageName, aliases ?? new ChangeTrackingList(), buffer, serializedAdditionalRawData); + return new DevOpsPoolVmImage( + resourceId, + wellKnownImageName, + aliases ?? new ChangeTrackingList(), + buffer, + ephemeralType, + serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.cs index 62da13c18c4e..e14eee5a9b74 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/DevOpsPoolVmImage.cs @@ -56,13 +56,15 @@ public DevOpsPoolVmImage() /// The image to use from a well-known set of images made available to customers. /// List of aliases to reference the image by. /// The percentage of the buffer to be allocated to this image. + /// The ephemeral type of the image. /// Keeps track of any properties unknown to the library. - internal DevOpsPoolVmImage(string resourceId, string wellKnownImageName, IList aliases, string buffer, IDictionary serializedAdditionalRawData) + internal DevOpsPoolVmImage(string resourceId, string wellKnownImageName, IList aliases, string buffer, EphemeralType? ephemeralType, IDictionary serializedAdditionalRawData) { ResourceId = resourceId; WellKnownImageName = wellKnownImageName; Aliases = aliases; Buffer = buffer; + EphemeralType = ephemeralType; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -74,5 +76,7 @@ internal DevOpsPoolVmImage(string resourceId, string wellKnownImageName, IList Aliases { get; } /// The percentage of the buffer to be allocated to this image. public string Buffer { get; set; } + /// The ephemeral type of the image. + public EphemeralType? EphemeralType { get; set; } } } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/EphemeralType.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/EphemeralType.cs new file mode 100644 index 000000000000..22740c036b08 --- /dev/null +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/EphemeralType.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.DevOpsInfrastructure.Models +{ + /// The type of Ephemeral option the pool will use on underlying VMs when loading this image. + public readonly partial struct EphemeralType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EphemeralType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutomaticValue = "Automatic"; + private const string CacheDiskValue = "CacheDisk"; + private const string ResourceDiskValue = "ResourceDisk"; + + /// Ephemeral is handled by Managed DevOps Pools service. + public static EphemeralType Automatic { get; } = new EphemeralType(AutomaticValue); + /// CacheDisk ephemeral only, requires that the SKU has a cache that is large enough for the image. + public static EphemeralType CacheDisk { get; } = new EphemeralType(CacheDiskValue); + /// ResourceDisk ephemeral only, requires only that the SKU supports it. + public static EphemeralType ResourceDisk { get; } = new EphemeralType(ResourceDiskValue); + /// Determines if two values are the same. + public static bool operator ==(EphemeralType left, EphemeralType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EphemeralType left, EphemeralType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator EphemeralType(string value) => new EphemeralType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EphemeralType other && Equals(other); + /// + public bool Equals(EphemeralType 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/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.Serialization.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.Serialization.cs index 8586fc37da26..f0e44da441ec 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.Serialization.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.Serialization.cs @@ -39,6 +39,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("certificateStoreLocation"u8); writer.WriteStringValue(CertificateStoreLocation); } + if (Optional.IsDefined(CertificateStoreName)) + { + writer.WritePropertyName("certificateStoreName"u8); + writer.WriteStringValue(CertificateStoreName.Value.ToString()); + } writer.WritePropertyName("observedCertificates"u8); writer.WriteStartArray(); foreach (var item in ObservedCertificates) @@ -91,6 +96,7 @@ internal static SecretsManagementSettings DeserializeSecretsManagementSettings(J return null; } string certificateStoreLocation = default; + CertificateStoreNameOption? certificateStoreName = default; IList observedCertificates = default; bool keyExportable = default; IDictionary serializedAdditionalRawData = default; @@ -102,6 +108,15 @@ internal static SecretsManagementSettings DeserializeSecretsManagementSettings(J certificateStoreLocation = property.Value.GetString(); continue; } + if (property.NameEquals("certificateStoreName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateStoreName = new CertificateStoreNameOption(property.Value.GetString()); + continue; + } if (property.NameEquals("observedCertificates"u8)) { List array = new List(); @@ -130,7 +145,7 @@ internal static SecretsManagementSettings DeserializeSecretsManagementSettings(J } } serializedAdditionalRawData = rawDataDictionary; - return new SecretsManagementSettings(certificateStoreLocation, observedCertificates, keyExportable, serializedAdditionalRawData); + return new SecretsManagementSettings(certificateStoreLocation, certificateStoreName, observedCertificates, keyExportable, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.cs index 7abbf15aff0d..31ab5987c6dd 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/Models/SecretsManagementSettings.cs @@ -60,12 +60,14 @@ public SecretsManagementSettings(IEnumerable observedCertificates, bool key /// Initializes a new instance of . /// Where to store certificates on the machine. + /// Name of the certificate store to use on the machine, currently 'My' and 'Root' are supported. /// The list of certificates to install on all machines in the pool. /// Defines if the key of the certificates should be exportable. /// Keeps track of any properties unknown to the library. - internal SecretsManagementSettings(string certificateStoreLocation, IList observedCertificates, bool keyExportable, IDictionary serializedAdditionalRawData) + internal SecretsManagementSettings(string certificateStoreLocation, CertificateStoreNameOption? certificateStoreName, IList observedCertificates, bool keyExportable, IDictionary serializedAdditionalRawData) { CertificateStoreLocation = certificateStoreLocation; + CertificateStoreName = certificateStoreName; ObservedCertificates = observedCertificates; KeyExportable = keyExportable; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -78,6 +80,8 @@ internal SecretsManagementSettings() /// Where to store certificates on the machine. public string CertificateStoreLocation { get; set; } + /// Name of the certificate store to use on the machine, currently 'My' and 'Root' are supported. + public CertificateStoreNameOption? CertificateStoreName { get; set; } /// The list of certificates to install on all machines in the pool. public IList ObservedCertificates { get; } /// Defines if the key of the certificates should be exportable. diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ImageVersionsRestOperations.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ImageVersionsRestOperations.cs index d99ce4db4901..4c87591a8f4b 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ImageVersionsRestOperations.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ImageVersionsRestOperations.cs @@ -32,7 +32,7 @@ public ImageVersionsRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-19"; + _apiVersion = apiVersion ?? "2025-01-21"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/PoolsRestOperations.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/PoolsRestOperations.cs index f1005eb73419..4d76059953f4 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/PoolsRestOperations.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/PoolsRestOperations.cs @@ -32,7 +32,7 @@ public PoolsRestOperations(HttpPipeline pipeline, string applicationId, Uri endp { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-19"; + _apiVersion = apiVersion ?? "2025-01-21"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -564,6 +564,92 @@ public Response ListBySubscription(string subscriptionId, Cancel } } + internal RequestUriBuilder CreateCheckNameAvailabilityRequestUri(string subscriptionId, CheckNameAvailability body) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCheckNameAvailabilityRequest(string subscriptionId, CheckNameAvailability body) + { + 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("/providers/Microsoft.DevOpsInfrastructure/checkNameAvailability", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(body, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Checks that the pool name is valid and is not already in use. + /// The ID of the target subscription. The value must be an UUID. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> CheckNameAvailabilityAsync(string subscriptionId, CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, body); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CheckNameAvailabilityResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks that the pool name is valid and is not already in use. + /// The ID of the target subscription. The value must be an UUID. + /// The CheckAvailability request. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckNameAvailability(string subscriptionId, CheckNameAvailability body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(body, nameof(body)); + + using var message = CreateCheckNameAvailabilityRequest(subscriptionId, body); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CheckNameAvailabilityResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CheckNameAvailabilityResult.DeserializeCheckNameAvailabilityResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ResourceDetailsRestOperations.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ResourceDetailsRestOperations.cs index 991d05cc6df2..7582c047adb3 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ResourceDetailsRestOperations.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/ResourceDetailsRestOperations.cs @@ -32,7 +32,7 @@ public ResourceDetailsRestOperations(HttpPipeline pipeline, string applicationId { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-19"; + _apiVersion = apiVersion ?? "2025-01-21"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SkuRestOperations.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SkuRestOperations.cs index 440151280b09..76886acea1df 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SkuRestOperations.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SkuRestOperations.cs @@ -32,7 +32,7 @@ public SkuRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoi { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-19"; + _apiVersion = apiVersion ?? "2025-01-21"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SubscriptionUsagesRestOperations.cs b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SubscriptionUsagesRestOperations.cs index 31da558f182f..31cb93876ffb 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SubscriptionUsagesRestOperations.cs +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/src/Generated/RestOperations/SubscriptionUsagesRestOperations.cs @@ -32,7 +32,7 @@ public SubscriptionUsagesRestOperations(HttpPipeline pipeline, string applicatio { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-19"; + _apiVersion = apiVersion ?? "2025-01-21"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/tsp-location.yaml b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/tsp-location.yaml index bea97fb31977..194c67546c30 100644 --- a/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/tsp-location.yaml +++ b/sdk/devopsinfrastructure/Azure.ResourceManager.DevOpsInfrastructure/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification/devopsinfrastructure -commit: f37b54b187bac95237c62478a10b94e9cff236f3 -repo: Azure/azure-rest-api-specs \ No newline at end of file +directory: specification/devopsinfrastructure/Microsoft.DevOpsInfrastructure.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.sln b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.sln new file mode 100644 index 000000000000..7fcb23ea74c2 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.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.SecretsStoreExtension.Samples", "samples\Azure.ResourceManager.SecretsStoreExtension.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.SecretsStoreExtension", "src\Azure.ResourceManager.SecretsStoreExtension.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.SecretsStoreExtension.Tests", "tests\Azure.ResourceManager.SecretsStoreExtension.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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/CHANGELOG.md b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md new file mode 100644 index 000000000000..9783f2218f26 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure SecretsStoreExtension 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 SecretsStoreExtension management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.SecretsStoreExtension --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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs new file mode 100644 index 000000000000..25b648a521ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs @@ -0,0 +1,346 @@ +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class AzureKeyVaultSecretProviderClassCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AzureKeyVaultSecretProviderClassCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, 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 AzureKeyVaultSecretProviderClassData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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 AzureKeyVaultSecretProviderClassResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AzureKeyVaultSecretProviderClassResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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 azureKeyVaultSecretProviderClassName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class SecretsStoreExtensionExtensions + { + public static Azure.Response GetAzureKeyVaultSecretProviderClass(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAzureKeyVaultSecretProviderClassAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAzureKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSecretSync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSecretSyncAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSecretSyncs(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSecretSyncsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SecretSyncCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SecretSyncCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string secretSyncName, 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 secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string secretSyncName, 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 SecretSyncData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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 SecretSyncResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SecretSyncResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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 secretSyncName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + public partial class MockableSecretsStoreExtensionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionArmClient() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecretsStoreExtensionResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionResourceGroupResource() { } + public virtual Azure.Response GetAzureKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses() { throw null; } + public virtual Azure.Response GetSecretSync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecretSyncAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs() { throw null; } + } + public partial class MockableSecretsStoreExtensionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionSubscriptionResource() { } + public virtual Azure.Pageable GetAzureKeyVaultSecretProviderClasses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecretSyncs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecretSyncsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public static partial class ArmSecretsStoreExtensionModelFactory + { + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData AzureKeyVaultSecretProviderClassData(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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties AzureKeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition SecretSyncCondition(System.DateTimeOffset? lastTransitionOn = default(System.DateTimeOffset?), string message = null, long? observedGeneration = default(long?), string reason = null, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType status = default(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType), string type = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncData SecretSyncData(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.SecretsStoreExtension.Models.SecretSyncProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType = default(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType), string forceSynchronization = null, System.Collections.Generic.IEnumerable objectSecretMapping = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus status = null, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus SecretSyncStatus(System.DateTimeOffset? lastSuccessfulSyncOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable conditions = null) { throw null; } + } + public partial class AzureKeyVaultSecretProviderClassPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch 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 AzureKeyVaultSecretProviderClassProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties 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 AzureKeyVaultSecretProviderClassUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassUpdateProperties() { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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 KubernetesSecretObjectMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) { } + public string SourcePath { get { throw null; } set { } } + public string TargetKey { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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 KubernetesSecretType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KubernetesSecretType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Opaque { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Tls { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType 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.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncCondition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncCondition() { } + public System.DateTimeOffset? LastTransitionOn { get { throw null; } } + public string Message { get { throw null; } } + public long? ObservedGeneration { get { throw null; } } + public string Reason { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType Status { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition 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.SecretsStoreExtension.Models.SecretSyncCondition 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 SecretSyncPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncPatch 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.SecretsStoreExtension.Models.SecretSyncPatch 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 SecretSyncProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType, System.Collections.Generic.IEnumerable objectSecretMapping) { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties 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.SecretsStoreExtension.Models.SecretSyncProperties 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 SecretSyncStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncStatus() { } + public System.Collections.Generic.IReadOnlyList Conditions { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulSyncOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus 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.SecretsStoreExtension.Models.SecretSyncStatus 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 SecretSyncUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncUpdateProperties() { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType? KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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 StatusConditionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StatusConditionType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType False { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType True { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType 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.SecretsStoreExtension.Models.StatusConditionType left, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType left, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs new file mode 100644 index 000000000000..25b648a521ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs @@ -0,0 +1,346 @@ +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class AzureKeyVaultSecretProviderClassCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AzureKeyVaultSecretProviderClassCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, 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 AzureKeyVaultSecretProviderClassData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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 AzureKeyVaultSecretProviderClassResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AzureKeyVaultSecretProviderClassResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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 azureKeyVaultSecretProviderClassName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class SecretsStoreExtensionExtensions + { + public static Azure.Response GetAzureKeyVaultSecretProviderClass(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAzureKeyVaultSecretProviderClassAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAzureKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSecretSync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSecretSyncAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSecretSyncs(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSecretSyncsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SecretSyncCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SecretSyncCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string secretSyncName, 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 secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string secretSyncName, 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 SecretSyncData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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 SecretSyncResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SecretSyncResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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 secretSyncName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + public partial class MockableSecretsStoreExtensionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionArmClient() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecretsStoreExtensionResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionResourceGroupResource() { } + public virtual Azure.Response GetAzureKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAzureKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses() { throw null; } + public virtual Azure.Response GetSecretSync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecretSyncAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs() { throw null; } + } + public partial class MockableSecretsStoreExtensionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionSubscriptionResource() { } + public virtual Azure.Pageable GetAzureKeyVaultSecretProviderClasses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecretSyncs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecretSyncsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public static partial class ArmSecretsStoreExtensionModelFactory + { + public static Azure.ResourceManager.SecretsStoreExtension.AzureKeyVaultSecretProviderClassData AzureKeyVaultSecretProviderClassData(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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties AzureKeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition SecretSyncCondition(System.DateTimeOffset? lastTransitionOn = default(System.DateTimeOffset?), string message = null, long? observedGeneration = default(long?), string reason = null, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType status = default(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType), string type = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncData SecretSyncData(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.SecretsStoreExtension.Models.SecretSyncProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType = default(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType), string forceSynchronization = null, System.Collections.Generic.IEnumerable objectSecretMapping = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus status = null, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus SecretSyncStatus(System.DateTimeOffset? lastSuccessfulSyncOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable conditions = null) { throw null; } + } + public partial class AzureKeyVaultSecretProviderClassPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassPatch 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 AzureKeyVaultSecretProviderClassProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassProperties 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 AzureKeyVaultSecretProviderClassUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassUpdateProperties() { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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 KubernetesSecretObjectMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) { } + public string SourcePath { get { throw null; } set { } } + public string TargetKey { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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 KubernetesSecretType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KubernetesSecretType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Opaque { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Tls { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType 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.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncCondition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncCondition() { } + public System.DateTimeOffset? LastTransitionOn { get { throw null; } } + public string Message { get { throw null; } } + public long? ObservedGeneration { get { throw null; } } + public string Reason { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType Status { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition 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.SecretsStoreExtension.Models.SecretSyncCondition 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 SecretSyncPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncPatch 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.SecretsStoreExtension.Models.SecretSyncPatch 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 SecretSyncProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType, System.Collections.Generic.IEnumerable objectSecretMapping) { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties 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.SecretsStoreExtension.Models.SecretSyncProperties 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 SecretSyncStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncStatus() { } + public System.Collections.Generic.IReadOnlyList Conditions { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulSyncOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus 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.SecretsStoreExtension.Models.SecretSyncStatus 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 SecretSyncUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncUpdateProperties() { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType? KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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 StatusConditionType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StatusConditionType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType False { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType True { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType 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.SecretsStoreExtension.Models.StatusConditionType left, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType left, Azure.ResourceManager.SecretsStoreExtension.Models.StatusConditionType right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json new file mode 100644 index 000000000000..ec76ab9ac35f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/secretsstoreextension/Azure.ResourceManager.SecretsStoreExtension", + "Tag": "" +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj new file mode 100644 index 000000000000..d0092ec948a0 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassCollection.cs new file mode 100644 index 000000000000..2e2fec4ab478 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_AzureKeyVaultSecretProviderClassCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AzureKeyVaultSecretProviderClassesCreateOrUpdate() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureKeyVaultSecretProviderClassResource + AzureKeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetAzureKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + AzureKeyVaultSecretProviderClassData data = new AzureKeyVaultSecretProviderClassData(new AzureLocation("eastus")) + { + Properties = new AzureKeyVaultSecretProviderClassProperties("example-ssc-key-vault", "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000") + { + Objects = "array: |\n - |\n objectName: my-secret-object\n objectType: secret\n objectVersionHistory: 1", + }, + ExtendedLocation = new ExtendedLocation + { + Name = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-ssc-example/providers/Microsoft.ExtendedLocation/customLocations/example-custom-location", + }, + Tags = +{ +["example-tag"] = "example-tag-value" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureKeyVaultSecretProviderClassName, data); + AzureKeyVaultSecretProviderClassResource 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 + AzureKeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureKeyVaultSecretProviderClassResource + AzureKeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetAzureKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + AzureKeyVaultSecretProviderClassResource result = await collection.GetAsync(azureKeyVaultSecretProviderClassName); + + // 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 + AzureKeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesListByResourceGroup() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureKeyVaultSecretProviderClassResource + AzureKeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetAzureKeyVaultSecretProviderClasses(); + + // invoke the operation and iterate over the result + await foreach (AzureKeyVaultSecretProviderClassResource 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 + AzureKeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureKeyVaultSecretProviderClassResource + AzureKeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetAzureKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + bool result = await collection.ExistsAsync(azureKeyVaultSecretProviderClassName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AzureKeyVaultSecretProviderClassResource + AzureKeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetAzureKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + NullableResponse response = await collection.GetIfExistsAsync(azureKeyVaultSecretProviderClassName); + AzureKeyVaultSecretProviderClassResource 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 + AzureKeyVaultSecretProviderClassData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassResource.cs new file mode 100644 index 000000000000..616e0fbd97fd --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_AzureKeyVaultSecretProviderClassResource.cs @@ -0,0 +1,120 @@ +// 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.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_AzureKeyVaultSecretProviderClassResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 AzureKeyVaultSecretProviderClassResource created on azure + // for more information of creating AzureKeyVaultSecretProviderClassResource, please refer to the document of AzureKeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier azureKeyVaultSecretProviderClassResourceId = AzureKeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + AzureKeyVaultSecretProviderClassResource azureKeyVaultSecretProviderClass = client.GetAzureKeyVaultSecretProviderClassResource(azureKeyVaultSecretProviderClassResourceId); + + // invoke the operation + AzureKeyVaultSecretProviderClassResource result = await azureKeyVaultSecretProviderClass.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 + AzureKeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesDelete() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 AzureKeyVaultSecretProviderClassResource created on azure + // for more information of creating AzureKeyVaultSecretProviderClassResource, please refer to the document of AzureKeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier azureKeyVaultSecretProviderClassResourceId = AzureKeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + AzureKeyVaultSecretProviderClassResource azureKeyVaultSecretProviderClass = client.GetAzureKeyVaultSecretProviderClassResource(azureKeyVaultSecretProviderClassResourceId); + + // invoke the operation + await azureKeyVaultSecretProviderClass.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AzureKeyVaultSecretProviderClassesUpdate() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Update_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 AzureKeyVaultSecretProviderClassResource created on azure + // for more information of creating AzureKeyVaultSecretProviderClassResource, please refer to the document of AzureKeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier azureKeyVaultSecretProviderClassResourceId = AzureKeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + AzureKeyVaultSecretProviderClassResource azureKeyVaultSecretProviderClass = client.GetAzureKeyVaultSecretProviderClassResource(azureKeyVaultSecretProviderClassResourceId); + + // invoke the operation + AzureKeyVaultSecretProviderClassPatch patch = new AzureKeyVaultSecretProviderClassPatch + { + Tags = +{ +["example-tag"] = "example-tag-value" +}, + Properties = new AzureKeyVaultSecretProviderClassUpdateProperties + { + KeyvaultName = "example-ssc-key-vault", + ClientId = "00000000-0000-0000-0000-000000000000", + TenantId = "00000000-0000-0000-0000-000000000000", + Objects = "array: |\n - |\n objectName: my-secret-object\n objectType: secret\n objectVersionHistory: 1", + }, + }; + ArmOperation lro = await azureKeyVaultSecretProviderClass.UpdateAsync(WaitUntil.Completed, patch); + AzureKeyVaultSecretProviderClassResource 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 + AzureKeyVaultSecretProviderClassData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs new file mode 100644 index 000000000000..d778174dd80a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SecretSyncCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SecretSyncsCreateOrUpdate() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + SecretSyncData data = new SecretSyncData(new AzureLocation("eastus")) + { + Properties = new SecretSyncProperties("akvspc-ssc-example", "example-k8s-sa-name", KubernetesSecretType.Opaque, new KubernetesSecretObjectMapping[] + { +new KubernetesSecretObjectMapping("kv-secret-name/0", "kv-secret-name/0") + }), + ExtendedLocation = new ExtendedLocation + { + Name = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-ssc-example/providers/Microsoft.ExtendedLocation/customLocations/example-custom-location", + }, + Tags = +{ +["example-tag"] = "example-tag-value" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, secretSyncName, data); + SecretSyncResource 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 + SecretSyncData 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_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + SecretSyncResource result = await collection.GetAsync(secretSyncName); + + // 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 + SecretSyncData 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_SecretSyncsListByResourceGroup() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation and iterate over the result + await foreach (SecretSyncResource 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 + SecretSyncData 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_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + bool result = await collection.ExistsAsync(secretSyncName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + NullableResponse response = await collection.GetIfExistsAsync(secretSyncName); + SecretSyncResource 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 + SecretSyncData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs new file mode 100644 index 000000000000..91beb50cc454 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs @@ -0,0 +1,121 @@ +// 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.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SecretSyncResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + SecretSyncResource result = await secretSync.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 + SecretSyncData 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_SecretSyncsDelete() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + await secretSync.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SecretSyncsUpdate() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Update_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + SecretSyncPatch patch = new SecretSyncPatch + { + Tags = +{ +["example-tag"] = "example-tag-value" +}, + Properties = new SecretSyncUpdateProperties + { + SecretProviderClassName = "jttlpenhtpxfrrlxdsmqqvmvtmgqrficvqngkggjwciilrexenlstxncyvkqcydxrivkioujssncoaiysdklfouukczzdbxniipbyiqsarqaespuqrbbydwtdaulllostoomntkadklihemfpeffvuyvyilequiqewzspaootvkibrynbqrsbiptjdhywynvydaadprdc", + ServiceAccountName = "fcldqfdfpktndlntuoxicsftelhefevovmlycflfwzckvamiqjnjugandqaqqeccsbzztfmmeunvhsafgerbcsdbnmsyqivygornebbkusuvphwghgouxvcbvmbydqjzoxextnyowsnyymadniwdrrxtogeveldpejixmsrzzfqkquaxdpzwvecevqwasxgxxchrfa", + KubernetesSecretType = KubernetesSecretType.Opaque, + ForceSynchronization = "arbitrarystring", + ObjectSecretMapping = { new KubernetesSecretObjectMapping("ssrzmbvdiomkvzrdsyilwlfzicfydnbjwjsnohrppkukjddrunfslkrnexunuckmghixdssposvndpiqchpqrkjuqbapoisvqdvgstvdonsmlpsmticfvuhqlofpaxfdg", "lojegeqiqfjxyblfxhxloccqzwgpgcelrwqwsbsltcjvjvceejgdrmxhenokxrylhynkltvqntjcvujjrppzvcxyivxeksgmzhifrcklizbpntdepzdl") }, + }, + }; + ArmOperation lro = await secretSync.UpdateAsync(WaitUntil.Completed, patch); + SecretSyncResource 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 + SecretSyncData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..0a3d98724284 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.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 Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAzureKeyVaultSecretProviderClasses_AzureKeyVaultSecretProviderClassesListBySubscription() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AzureKeyVaultSecretProviderClassResource item in subscriptionResource.GetAzureKeyVaultSecretProviderClassesAsync()) + { + // 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 + AzureKeyVaultSecretProviderClassData 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 GetSecretSyncs_SecretSyncsListBySubscription() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SecretSyncResource item in subscriptionResource.GetSecretSyncsAsync()) + { + // 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 + SecretSyncData 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj new file mode 100644 index 000000000000..1198b8554e01 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider SecretsStoreExtension. + 1.0.0-beta.1 + azure;management;arm;resource manager;secretsstoreextension + Azure.ResourceManager.SecretsStoreExtension + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs new file mode 100644 index 000000000000..e3f4a5326ccc --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs @@ -0,0 +1,145 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// Model factory for models. + public static partial class ArmSecretsStoreExtensionModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// + /// A new instance for mocking. + public static SecretSyncData SecretSyncData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SecretSyncProperties properties = null, ExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new SecretSyncData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// SecretSyncStatus defines the observed state of the secret synchronization process. + /// Provisioning state of the SecretSync instance. + /// A new instance for mocking. + public static SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, KubernetesSecretType kubernetesSecretType = default, string forceSynchronization = null, IEnumerable objectSecretMapping = null, SecretSyncStatus status = null, ProvisioningState? provisioningState = null) + { + objectSecretMapping ??= new List(); + + return new SecretSyncProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping?.ToList(), + status, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + /// A new instance for mocking. + public static SecretSyncStatus SecretSyncStatus(DateTimeOffset? lastSuccessfulSyncOn = null, IEnumerable conditions = null) + { + conditions ??= new List(); + + return new SecretSyncStatus(lastSuccessfulSyncOn, conditions?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + /// A new instance for mocking. + public static SecretSyncCondition SecretSyncCondition(DateTimeOffset? lastTransitionOn = null, string message = null, long? observedGeneration = null, string reason = null, StatusConditionType status = default, string type = null) + { + return new SecretSyncCondition( + lastTransitionOn, + message, + observedGeneration, + reason, + status, + type, + 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. + /// + /// A new instance for mocking. + public static AzureKeyVaultSecretProviderClassData AzureKeyVaultSecretProviderClassData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AzureKeyVaultSecretProviderClassProperties properties = null, ExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new AzureKeyVaultSecretProviderClassData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + /// A new instance for mocking. + public static AzureKeyVaultSecretProviderClassProperties AzureKeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, ProvisioningState? provisioningState = null) + { + return new AzureKeyVaultSecretProviderClassProperties( + keyvaultName, + clientId, + tenantId, + objects, + provisioningState, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassCollection.cs new file mode 100644 index 000000000000..7ad2d6bb4858 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassCollection.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.SecretsStoreExtension +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAzureKeyVaultSecretProviderClasses method from an instance of . + /// + public partial class AzureKeyVaultSecretProviderClassCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _azureKeyVaultSecretProviderClassClientDiagnostics; + private readonly AzureKeyVaultSecretProviderClassesRestOperations _azureKeyVaultSecretProviderClassRestClient; + + /// Initializes a new instance of the class for mocking. + protected AzureKeyVaultSecretProviderClassCollection() + { + } + + /// 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 AzureKeyVaultSecretProviderClassCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _azureKeyVaultSecretProviderClassClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", AzureKeyVaultSecretProviderClassResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AzureKeyVaultSecretProviderClassResource.ResourceType, out string azureKeyVaultSecretProviderClassApiVersion); + _azureKeyVaultSecretProviderClassRestClient = new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, azureKeyVaultSecretProviderClassApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new AzureKeyVaultSecretProviderClassOperationSource(Client), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new AzureKeyVaultSecretProviderClassOperationSource(Client), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.Get"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.Get"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _azureKeyVaultSecretProviderClassRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _azureKeyVaultSecretProviderClassRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureKeyVaultSecretProviderClassResource(Client, AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(e)), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, "AzureKeyVaultSecretProviderClassCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _azureKeyVaultSecretProviderClassRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _azureKeyVaultSecretProviderClassRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureKeyVaultSecretProviderClassResource(Client, AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(e)), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, "AzureKeyVaultSecretProviderClassCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.Exists"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.Exists"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassCollection.GetIfExists"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.Serialization.cs new file mode 100644 index 000000000000..b26f569086d6 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.Serialization.cs @@ -0,0 +1,195 @@ +// 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; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class AzureKeyVaultSecretProviderClassData : 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(AzureKeyVaultSecretProviderClassData)} 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(ExtendedLocation)) + { + writer.WritePropertyName("extendedLocation"u8); + JsonSerializer.Serialize(writer, ExtendedLocation); + } + } + + AzureKeyVaultSecretProviderClassData 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(AzureKeyVaultSecretProviderClassData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassData DeserializeAzureKeyVaultSecretProviderClassData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureKeyVaultSecretProviderClassProperties properties = default; + ExtendedLocation extendedLocation = 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 = AzureKeyVaultSecretProviderClassProperties.DeserializeAzureKeyVaultSecretProviderClassProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("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 AzureKeyVaultSecretProviderClassData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + 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(AzureKeyVaultSecretProviderClassData)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.cs new file mode 100644 index 000000000000..1224c7e04072 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassData.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A class representing the AzureKeyVaultSecretProviderClass data model. + /// The AzureKeyVaultSecretProviderClass resource. + /// + public partial class AzureKeyVaultSecretProviderClassData : 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 AzureKeyVaultSecretProviderClassData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AzureKeyVaultSecretProviderClassProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureKeyVaultSecretProviderClassData() + { + } + + /// The resource-specific properties for this resource. + public AzureKeyVaultSecretProviderClassProperties Properties { get; set; } + /// Gets or sets the extended location. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.Serialization.cs new file mode 100644 index 000000000000..e0a3a2e42192 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.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.SecretsStoreExtension +{ + public partial class AzureKeyVaultSecretProviderClassResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AzureKeyVaultSecretProviderClassData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AzureKeyVaultSecretProviderClassData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.cs new file mode 100644 index 000000000000..f12a0d5408a7 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/AzureKeyVaultSecretProviderClassResource.cs @@ -0,0 +1,707 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A Class representing an AzureKeyVaultSecretProviderClass along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAzureKeyVaultSecretProviderClassResource method. + /// Otherwise you can get one from its parent resource using the GetAzureKeyVaultSecretProviderClass method. + /// + public partial class AzureKeyVaultSecretProviderClassResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureKeyVaultSecretProviderClassName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _azureKeyVaultSecretProviderClassClientDiagnostics; + private readonly AzureKeyVaultSecretProviderClassesRestOperations _azureKeyVaultSecretProviderClassRestClient; + private readonly AzureKeyVaultSecretProviderClassData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses"; + + /// Initializes a new instance of the class for mocking. + protected AzureKeyVaultSecretProviderClassResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AzureKeyVaultSecretProviderClassResource(ArmClient client, AzureKeyVaultSecretProviderClassData 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 AzureKeyVaultSecretProviderClassResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _azureKeyVaultSecretProviderClassClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string azureKeyVaultSecretProviderClassApiVersion); + _azureKeyVaultSecretProviderClassRestClient = new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, azureKeyVaultSecretProviderClassApiVersion); +#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 AzureKeyVaultSecretProviderClassData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Get"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Get"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Delete"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(_azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.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; + } + } + + /// + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Delete"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(_azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.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; + } + } + + /// + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Update + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AzureKeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Update"); + scope.Start(); + try + { + var response = await _azureKeyVaultSecretProviderClassRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new AzureKeyVaultSecretProviderClassOperationSource(Client), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.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; + } + } + + /// + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Update + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AzureKeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.Update"); + scope.Start(); + try + { + var response = _azureKeyVaultSecretProviderClassRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new AzureKeyVaultSecretProviderClassOperationSource(Client), _azureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, _azureKeyVaultSecretProviderClassRestClient.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; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 _azureKeyVaultSecretProviderClassRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _azureKeyVaultSecretProviderClassClientDiagnostics.CreateScope("AzureKeyVaultSecretProviderClassResource.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 = _azureKeyVaultSecretProviderClassRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AzureKeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AzureKeyVaultSecretProviderClassPatch(); + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs new file mode 100644 index 000000000000..4903dcc46299 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecretsStoreExtensionArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionArmClient() + { + } + + /// 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 MockableSecretsStoreExtensionArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSecretsStoreExtensionArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(ResourceIdentifier id) + { + AzureKeyVaultSecretProviderClassResource.ValidateResourceId(id); + return new AzureKeyVaultSecretProviderClassResource(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 SecretSyncResource GetSecretSyncResource(ResourceIdentifier id) + { + SecretSyncResource.ValidateResourceId(id); + return new SecretSyncResource(Client, id); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs new file mode 100644 index 000000000000..8c32644d5b13 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs @@ -0,0 +1,174 @@ +// 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.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSecretsStoreExtensionResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionResourceGroupResource() + { + } + + /// 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 MockableSecretsStoreExtensionResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AzureKeyVaultSecretProviderClassResources in the ResourceGroupResource. + /// An object representing collection of AzureKeyVaultSecretProviderClassResources and their operations over a AzureKeyVaultSecretProviderClassResource. + public virtual AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses() + { + return GetCachedClient(client => new AzureKeyVaultSecretProviderClassCollection(client, Id)); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAzureKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + return await GetAzureKeyVaultSecretProviderClasses().GetAsync(azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAzureKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + return GetAzureKeyVaultSecretProviderClasses().Get(azureKeyVaultSecretProviderClassName, cancellationToken); + } + + /// Gets a collection of SecretSyncResources in the ResourceGroupResource. + /// An object representing collection of SecretSyncResources and their operations over a SecretSyncResource. + public virtual SecretSyncCollection GetSecretSyncs() + { + return GetCachedClient(client => new SecretSyncCollection(client, Id)); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecretSyncAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + return await GetSecretSyncs().GetAsync(secretSyncName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecretSync(string secretSyncName, CancellationToken cancellationToken = default) + { + return GetSecretSyncs().Get(secretSyncName, cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs new file mode 100644 index 000000000000..d159e0453630 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs @@ -0,0 +1,166 @@ +// 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.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSecretsStoreExtensionSubscriptionResource : ArmResource + { + private ClientDiagnostics _azureKeyVaultSecretProviderClassClientDiagnostics; + private AzureKeyVaultSecretProviderClassesRestOperations _azureKeyVaultSecretProviderClassRestClient; + private ClientDiagnostics _secretSyncClientDiagnostics; + private SecretSyncsRestOperations _secretSyncRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionSubscriptionResource() + { + } + + /// 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 MockableSecretsStoreExtensionSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AzureKeyVaultSecretProviderClassClientDiagnostics => _azureKeyVaultSecretProviderClassClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", AzureKeyVaultSecretProviderClassResource.ResourceType.Namespace, Diagnostics); + private AzureKeyVaultSecretProviderClassesRestOperations AzureKeyVaultSecretProviderClassRestClient => _azureKeyVaultSecretProviderClassRestClient ??= new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AzureKeyVaultSecretProviderClassResource.ResourceType)); + private ClientDiagnostics SecretSyncClientDiagnostics => _secretSyncClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", SecretSyncResource.ResourceType.Namespace, Diagnostics); + private SecretSyncsRestOperations SecretSyncRestClient => _secretSyncRestClient ??= new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecretSyncResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureKeyVaultSecretProviderClassRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureKeyVaultSecretProviderClassRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AzureKeyVaultSecretProviderClassResource(Client, AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(e)), AzureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetAzureKeyVaultSecretProviderClasses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAzureKeyVaultSecretProviderClasses(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AzureKeyVaultSecretProviderClassRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AzureKeyVaultSecretProviderClassRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AzureKeyVaultSecretProviderClassResource(Client, AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(e)), AzureKeyVaultSecretProviderClassClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetAzureKeyVaultSecretProviderClasses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecretSyncsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecretSyncRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecretSyncRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), SecretSyncClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetSecretSyncs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecretSyncs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecretSyncRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecretSyncRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), SecretSyncClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetSecretSyncs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs new file mode 100644 index 000000000000..7c44868ba598 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs @@ -0,0 +1,403 @@ +// 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.Resources; +using Azure.ResourceManager.SecretsStoreExtension.Mocking; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// A class to add extension methods to Azure.ResourceManager.SecretsStoreExtension. + public static partial class SecretsStoreExtensionExtensions + { + private static MockableSecretsStoreExtensionArmClient GetMockableSecretsStoreExtensionArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableSecretsStoreExtensionArmClient(client0)); + } + + private static MockableSecretsStoreExtensionResourceGroupResource GetMockableSecretsStoreExtensionResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableSecretsStoreExtensionResourceGroupResource(client, resource.Id)); + } + + private static MockableSecretsStoreExtensionSubscriptionResource GetMockableSecretsStoreExtensionSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableSecretsStoreExtensionSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AzureKeyVaultSecretProviderClassResource GetAzureKeyVaultSecretProviderClassResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSecretsStoreExtensionArmClient(client).GetAzureKeyVaultSecretProviderClassResource(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 SecretSyncResource GetSecretSyncResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSecretsStoreExtensionArmClient(client).GetSecretSyncResource(id); + } + + /// + /// Gets a collection of AzureKeyVaultSecretProviderClassResources 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 AzureKeyVaultSecretProviderClassResources and their operations over a AzureKeyVaultSecretProviderClassResource. + public static AzureKeyVaultSecretProviderClassCollection GetAzureKeyVaultSecretProviderClasses(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetAzureKeyVaultSecretProviderClasses(); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetAzureKeyVaultSecretProviderClassAsync(this ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetAzureKeyVaultSecretProviderClassAsync(azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetAzureKeyVaultSecretProviderClass(this ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetAzureKeyVaultSecretProviderClass(azureKeyVaultSecretProviderClassName, cancellationToken); + } + + /// + /// Gets a collection of SecretSyncResources 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 SecretSyncResources and their operations over a SecretSyncResource. + public static SecretSyncCollection GetSecretSyncs(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSyncs(); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the SecretSync. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSecretSyncAsync(this ResourceGroupResource resourceGroupResource, string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSyncAsync(secretSyncName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the SecretSync. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSecretSync(this ResourceGroupResource resourceGroupResource, string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSync(secretSyncName, cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAzureKeyVaultSecretProviderClassesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetAzureKeyVaultSecretProviderClassesAsync(cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAzureKeyVaultSecretProviderClasses(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetAzureKeyVaultSecretProviderClasses(cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSecretSyncsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetSecretSyncsAsync(cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSecretSyncs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetSecretSyncs(cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Argument.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..6cdd3b1396e5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..5192ce1963d5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingList.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..c7dafad335d0 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..8c10256223b3 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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.SecretsStoreExtension +{ + internal static class ModelSerializationExtensions + { + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Optional.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..644b867699a9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..22b3c476099e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/AzureKeyVaultSecretProviderClassOperationSource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/AzureKeyVaultSecretProviderClassOperationSource.cs new file mode 100644 index 000000000000..9c59c8228047 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/AzureKeyVaultSecretProviderClassOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal class AzureKeyVaultSecretProviderClassOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AzureKeyVaultSecretProviderClassOperationSource(ArmClient client) + { + _client = client; + } + + AzureKeyVaultSecretProviderClassResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement); + return new AzureKeyVaultSecretProviderClassResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement); + return new AzureKeyVaultSecretProviderClassResource(_client, data); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs new file mode 100644 index 000000000000..b59c659e70ba --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal class SecretSyncOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SecretSyncOperationSource(ArmClient client) + { + _client = client; + } + + SecretSyncResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return new SecretSyncResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return new SecretSyncResource(_client, data); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.cs new file mode 100644 index 000000000000..27aad176952b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.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.SecretsStoreExtension +{ +#pragma warning disable SA1649 // File name should match first type name + internal class SecretsStoreExtensionArmOperation : 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 SecretsStoreExtensionArmOperation for mocking. + protected SecretsStoreExtensionArmOperation() + { + } + + internal SecretsStoreExtensionArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal SecretsStoreExtensionArmOperation(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, "SecretsStoreExtensionArmOperation", 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.cs new file mode 100644 index 000000000000..f4bf9be94add --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.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.SecretsStoreExtension +{ +#pragma warning disable SA1649 // File name should match first type name + internal class SecretsStoreExtensionArmOperation : 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 SecretsStoreExtensionArmOperation for mocking. + protected SecretsStoreExtensionArmOperation() + { + } + + internal SecretsStoreExtensionArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal SecretsStoreExtensionArmOperation(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, "SecretsStoreExtensionArmOperation", 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.Serialization.cs new file mode 100644 index 000000000000..bf215f6ba359 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.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.SecretsStoreExtension.Models +{ + internal partial class AzureKeyVaultSecretProviderClassListResult : 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(AzureKeyVaultSecretProviderClassListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureKeyVaultSecretProviderClassListResult 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(AzureKeyVaultSecretProviderClassListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassListResult DeserializeAzureKeyVaultSecretProviderClassListResult(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(AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(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 AzureKeyVaultSecretProviderClassListResult(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(AzureKeyVaultSecretProviderClassListResult)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.cs new file mode 100644 index 000000000000..8756936be78d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.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.SecretsStoreExtension.Models +{ + /// The response of a AzureKeyVaultSecretProviderClass list operation. + internal partial class AzureKeyVaultSecretProviderClassListResult + { + /// + /// 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 AzureKeyVaultSecretProviderClass items on this page. + /// is null. + internal AzureKeyVaultSecretProviderClassListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AzureKeyVaultSecretProviderClass items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureKeyVaultSecretProviderClassListResult() + { + } + + /// The AzureKeyVaultSecretProviderClass items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.Serialization.cs new file mode 100644 index 000000000000..03b818f2bbf3 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.Serialization.cs @@ -0,0 +1,159 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class AzureKeyVaultSecretProviderClassPatch : 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(AzureKeyVaultSecretProviderClassPatch)} does not support writing '{format}' format."); + } + + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureKeyVaultSecretProviderClassPatch 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(AzureKeyVaultSecretProviderClassPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassPatch(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassPatch DeserializeAzureKeyVaultSecretProviderClassPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + AzureKeyVaultSecretProviderClassUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AzureKeyVaultSecretProviderClassUpdateProperties.DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureKeyVaultSecretProviderClassPatch(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(AzureKeyVaultSecretProviderClassPatch)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretProviderClassPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.cs new file mode 100644 index 000000000000..9816d553cdd3 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The type used for update operations of the AzureKeyVaultSecretProviderClass. + public partial class AzureKeyVaultSecretProviderClassPatch + { + /// + /// 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 AzureKeyVaultSecretProviderClassPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassPatch(IDictionary tags, AzureKeyVaultSecretProviderClassUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public AzureKeyVaultSecretProviderClassUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.Serialization.cs new file mode 100644 index 000000000000..1982d325cc55 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.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.SecretsStoreExtension.Models +{ + public partial class AzureKeyVaultSecretProviderClassProperties : 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(AzureKeyVaultSecretProviderClassProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("keyvaultName"u8); + writer.WriteStringValue(KeyvaultName); + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + if (Optional.IsDefined(Objects)) + { + writer.WritePropertyName("objects"u8); + writer.WriteStringValue(Objects); + } + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureKeyVaultSecretProviderClassProperties 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(AzureKeyVaultSecretProviderClassProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassProperties(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassProperties DeserializeAzureKeyVaultSecretProviderClassProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string keyvaultName = default; + string clientId = default; + string tenantId = default; + string objects = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyvaultName"u8)) + { + keyvaultName = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objects"u8)) + { + objects = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureKeyVaultSecretProviderClassProperties( + keyvaultName, + clientId, + tenantId, + objects, + 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(AzureKeyVaultSecretProviderClassProperties)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretProviderClassProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.cs new file mode 100644 index 000000000000..4f5aa33eac3e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassProperties.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.SecretsStoreExtension.Models +{ + /// The properties of the AzureKeyVaultSecretProviderClass. + public partial class AzureKeyVaultSecretProviderClassProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// , or is null. + public AzureKeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) + { + Argument.AssertNotNull(keyvaultName, nameof(keyvaultName)); + Argument.AssertNotNull(clientId, nameof(clientId)); + Argument.AssertNotNull(tenantId, nameof(tenantId)); + + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId, string objects, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + Objects = objects; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureKeyVaultSecretProviderClassProperties() + { + } + + /// The name of the Azure Key Vault to sync secrets from. + public string KeyvaultName { get; set; } + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + public string ClientId { get; set; } + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + public string TenantId { get; set; } + /// Objects defines the desired state of synced K8s secret objects. + public string Objects { get; set; } + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..a67de0029f25 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs @@ -0,0 +1,162 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class AzureKeyVaultSecretProviderClassUpdateProperties : 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KeyvaultName)) + { + writer.WritePropertyName("keyvaultName"u8); + writer.WriteStringValue(KeyvaultName); + } + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + } + if (Optional.IsDefined(Objects)) + { + writer.WritePropertyName("objects"u8); + writer.WriteStringValue(Objects); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AzureKeyVaultSecretProviderClassUpdateProperties 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassUpdateProperties DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string keyvaultName = default; + string clientId = default; + string tenantId = default; + string objects = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyvaultName"u8)) + { + keyvaultName = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objects"u8)) + { + objects = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureKeyVaultSecretProviderClassUpdateProperties(keyvaultName, clientId, tenantId, objects, 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs new file mode 100644 index 000000000000..8871ec453a6f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The updatable properties of the AzureKeyVaultSecretProviderClass. + public partial class AzureKeyVaultSecretProviderClassUpdateProperties + { + /// + /// 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 AzureKeyVaultSecretProviderClassUpdateProperties() + { + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassUpdateProperties(string keyvaultName, string clientId, string tenantId, string objects, IDictionary serializedAdditionalRawData) + { + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + Objects = objects; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the Azure Key Vault to sync secrets from. + public string KeyvaultName { get; set; } + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + public string ClientId { get; set; } + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + public string TenantId { get; set; } + /// Objects defines the desired state of synced K8s secret objects. + public string Objects { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs new file mode 100644 index 000000000000..227145e11cf1 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class KubernetesSecretObjectMapping : 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(KubernetesSecretObjectMapping)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("sourcePath"u8); + writer.WriteStringValue(SourcePath); + writer.WritePropertyName("targetKey"u8); + writer.WriteStringValue(TargetKey); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KubernetesSecretObjectMapping 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(KubernetesSecretObjectMapping)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKubernetesSecretObjectMapping(document.RootElement, options); + } + + internal static KubernetesSecretObjectMapping DeserializeKubernetesSecretObjectMapping(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string sourcePath = default; + string targetKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourcePath"u8)) + { + sourcePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetKey"u8)) + { + targetKey = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KubernetesSecretObjectMapping(sourcePath, targetKey, 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(KubernetesSecretObjectMapping)} does not support writing '{options.Format}' format."); + } + } + + KubernetesSecretObjectMapping IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeKubernetesSecretObjectMapping(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KubernetesSecretObjectMapping)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs new file mode 100644 index 000000000000..6215cee11c1b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// Properties defining the mapping between a cloud secret store object and a Kubernetes Secret. + public partial class KubernetesSecretObjectMapping + { + /// + /// 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 . + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + /// or is null. + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) + { + Argument.AssertNotNull(sourcePath, nameof(sourcePath)); + Argument.AssertNotNull(targetKey, nameof(targetKey)); + + SourcePath = sourcePath; + TargetKey = targetKey; + } + + /// Initializes a new instance of . + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + /// Keeps track of any properties unknown to the library. + internal KubernetesSecretObjectMapping(string sourcePath, string targetKey, IDictionary serializedAdditionalRawData) + { + SourcePath = sourcePath; + TargetKey = targetKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KubernetesSecretObjectMapping() + { + } + + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + public string SourcePath { get; set; } + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + public string TargetKey { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.cs new file mode 100644 index 000000000000..44a8f0b0c321 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.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.SecretsStoreExtension.Models +{ + /// Supported Kubernetes secret types. + public readonly partial struct KubernetesSecretType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KubernetesSecretType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OpaqueValue = "Opaque"; + private const string TlsValue = "kubernetes.io/tls"; + + /// Opaque is the default secret type. + public static KubernetesSecretType Opaque { get; } = new KubernetesSecretType(OpaqueValue); + /// The kubernetes.io/tls secret type is for storing a certificate and its associated key that are typically used for TLS. + public static KubernetesSecretType Tls { get; } = new KubernetesSecretType(TlsValue); + /// Determines if two values are the same. + public static bool operator ==(KubernetesSecretType left, KubernetesSecretType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KubernetesSecretType left, KubernetesSecretType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KubernetesSecretType(string value) => new KubernetesSecretType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KubernetesSecretType other && Equals(other); + /// + public bool Equals(KubernetesSecretType 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/ProvisioningState.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..7d9485d78e3d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/ProvisioningState.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.SecretsStoreExtension.Models +{ + /// Provisioning state of the resource. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Resource creation failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs new file mode 100644 index 000000000000..3ae445f39a59 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs @@ -0,0 +1,199 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class SecretSyncCondition : 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(SecretSyncCondition)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(LastTransitionOn)) + { + writer.WritePropertyName("lastTransitionTime"u8); + writer.WriteStringValue(LastTransitionOn.Value, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && Optional.IsDefined(ObservedGeneration)) + { + writer.WritePropertyName("observedGeneration"u8); + writer.WriteNumberValue(ObservedGeneration.Value); + } + if (options.Format != "W") + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (options.Format != "W") + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncCondition 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(SecretSyncCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncCondition(document.RootElement, options); + } + + internal static SecretSyncCondition DeserializeSecretSyncCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? lastTransitionTime = default; + string message = default; + long? observedGeneration = default; + string reason = default; + StatusConditionType status = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastTransitionTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastTransitionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("observedGeneration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observedGeneration = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new StatusConditionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncCondition( + lastTransitionTime, + message, + observedGeneration, + reason, + status, + type, + 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(SecretSyncCondition)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncCondition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs new file mode 100644 index 000000000000..381ce12ae6bf --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// A condition represents the status of the secret create and update processes. + public partial class SecretSyncCondition + { + /// + /// 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 . + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + internal SecretSyncCondition(string message, string reason, StatusConditionType status, string type) + { + Message = message; + Reason = reason; + Status = status; + Type = type; + } + + /// Initializes a new instance of . + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + /// Keeps track of any properties unknown to the library. + internal SecretSyncCondition(DateTimeOffset? lastTransitionOn, string message, long? observedGeneration, string reason, StatusConditionType status, string type, IDictionary serializedAdditionalRawData) + { + LastTransitionOn = lastTransitionOn; + Message = message; + ObservedGeneration = observedGeneration; + Reason = reason; + Status = status; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncCondition() + { + } + + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + public DateTimeOffset? LastTransitionOn { get; } + /// Message is a human readable message indicating details about the transition. This may be an empty string. + public string Message { get; } + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + public long? ObservedGeneration { get; } + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + public string Reason { get; } + /// Status of the condition, one of True, False, Unknown. + public StatusConditionType Status { get; } + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + public string Type { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.Serialization.cs new file mode 100644 index 000000000000..ed49bc213fa1 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.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.SecretsStoreExtension.Models +{ + internal partial class SecretSyncListResult : 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(SecretSyncListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncListResult 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(SecretSyncListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncListResult(document.RootElement, options); + } + + internal static SecretSyncListResult DeserializeSecretSyncListResult(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(SecretSyncData.DeserializeSecretSyncData(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 SecretSyncListResult(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(SecretSyncListResult)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.cs new file mode 100644 index 000000000000..e127d189a9ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.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.SecretsStoreExtension.Models +{ + /// The response of a SecretSync list operation. + internal partial class SecretSyncListResult + { + /// + /// 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 SecretSync items on this page. + /// is null. + internal SecretSyncListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SecretSync items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SecretSyncListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncListResult() + { + } + + /// The SecretSync items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs new file mode 100644 index 000000000000..74e4ef7f0629 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs @@ -0,0 +1,159 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncPatch : 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(SecretSyncPatch)} does not support writing '{format}' format."); + } + + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncPatch 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(SecretSyncPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncPatch(document.RootElement, options); + } + + internal static SecretSyncPatch DeserializeSecretSyncPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + SecretSyncUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SecretSyncUpdateProperties.DeserializeSecretSyncUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncPatch(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(SecretSyncPatch)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs new file mode 100644 index 000000000000..01b1a16a1242 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The type used for update operations of the SecretSync. + public partial class SecretSyncPatch + { + /// + /// 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 SecretSyncPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SecretSyncPatch(IDictionary tags, SecretSyncUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public SecretSyncUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs new file mode 100644 index 000000000000..af0fb4317dc7 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs @@ -0,0 +1,209 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncProperties : 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(SecretSyncProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("secretProviderClassName"u8); + writer.WriteStringValue(SecretProviderClassName); + writer.WritePropertyName("serviceAccountName"u8); + writer.WriteStringValue(ServiceAccountName); + writer.WritePropertyName("kubernetesSecretType"u8); + writer.WriteStringValue(KubernetesSecretType.ToString()); + if (Optional.IsDefined(ForceSynchronization)) + { + writer.WritePropertyName("forceSynchronization"u8); + writer.WriteStringValue(ForceSynchronization); + } + writer.WritePropertyName("objectSecretMapping"u8); + writer.WriteStartArray(); + foreach (var item in ObjectSecretMapping) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncProperties 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(SecretSyncProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncProperties(document.RootElement, options); + } + + internal static SecretSyncProperties DeserializeSecretSyncProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretProviderClassName = default; + string serviceAccountName = default; + KubernetesSecretType kubernetesSecretType = default; + string forceSynchronization = default; + IList objectSecretMapping = default; + SecretSyncStatus status = default; + ProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretProviderClassName"u8)) + { + secretProviderClassName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceAccountName"u8)) + { + serviceAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesSecretType"u8)) + { + kubernetesSecretType = new KubernetesSecretType(property.Value.GetString()); + continue; + } + if (property.NameEquals("forceSynchronization"u8)) + { + forceSynchronization = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectSecretMapping"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesSecretObjectMapping.DeserializeKubernetesSecretObjectMapping(item, options)); + } + objectSecretMapping = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = SecretSyncStatus.DeserializeSecretSyncStatus(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping, + 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(SecretSyncProperties)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs new file mode 100644 index 000000000000..06ecef615919 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs @@ -0,0 +1,108 @@ +// 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.SecretsStoreExtension.Models +{ + /// The properties of the SecretSync instance. + public partial class SecretSyncProperties + { + /// + /// 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 . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// , or is null. + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType kubernetesSecretType, IEnumerable objectSecretMapping) + { + Argument.AssertNotNull(secretProviderClassName, nameof(secretProviderClassName)); + Argument.AssertNotNull(serviceAccountName, nameof(serviceAccountName)); + Argument.AssertNotNull(objectSecretMapping, nameof(objectSecretMapping)); + + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ObjectSecretMapping = objectSecretMapping.ToList(); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// SecretSyncStatus defines the observed state of the secret synchronization process. + /// Provisioning state of the SecretSync instance. + /// Keeps track of any properties unknown to the library. + internal SecretSyncProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType kubernetesSecretType, string forceSynchronization, IList objectSecretMapping, SecretSyncStatus status, ProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ForceSynchronization = forceSynchronization; + ObjectSecretMapping = objectSecretMapping; + Status = status; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncProperties() + { + } + + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + public string SecretProviderClassName { get; set; } + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + public string ServiceAccountName { get; set; } + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + public KubernetesSecretType KubernetesSecretType { get; set; } + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + public string ForceSynchronization { get; set; } + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + public IList ObjectSecretMapping { get; } + /// SecretSyncStatus defines the observed state of the secret synchronization process. + public SecretSyncStatus Status { get; } + /// Provisioning state of the SecretSync instance. + public ProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs new file mode 100644 index 000000000000..188bec74ee2d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs @@ -0,0 +1,158 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncStatus : 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(SecretSyncStatus)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(LastSuccessfulSyncOn)) + { + writer.WritePropertyName("lastSuccessfulSyncTime"u8); + writer.WriteStringValue(LastSuccessfulSyncOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Conditions)) + { + writer.WritePropertyName("conditions"u8); + writer.WriteStartArray(); + foreach (var item in Conditions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncStatus 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(SecretSyncStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncStatus(document.RootElement, options); + } + + internal static SecretSyncStatus DeserializeSecretSyncStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? lastSuccessfulSyncTime = default; + IReadOnlyList conditions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastSuccessfulSyncTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSuccessfulSyncTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("conditions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SecretSyncCondition.DeserializeSecretSyncCondition(item, options)); + } + conditions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncStatus(lastSuccessfulSyncTime, conditions ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncStatus)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncStatus IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs new file mode 100644 index 000000000000..66e1646e429b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// SecretSyncStatus defines the observed state of the secret synchronization process. + public partial class SecretSyncStatus + { + /// + /// 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 SecretSyncStatus() + { + Conditions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + /// Keeps track of any properties unknown to the library. + internal SecretSyncStatus(DateTimeOffset? lastSuccessfulSyncOn, IReadOnlyList conditions, IDictionary serializedAdditionalRawData) + { + LastSuccessfulSyncOn = lastSuccessfulSyncOn; + Conditions = conditions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + public DateTimeOffset? LastSuccessfulSyncOn { get; } + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + public IReadOnlyList Conditions { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..89bfd36adf7a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class SecretSyncUpdateProperties : 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(SecretSyncUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SecretProviderClassName)) + { + writer.WritePropertyName("secretProviderClassName"u8); + writer.WriteStringValue(SecretProviderClassName); + } + if (Optional.IsDefined(ServiceAccountName)) + { + writer.WritePropertyName("serviceAccountName"u8); + writer.WriteStringValue(ServiceAccountName); + } + if (Optional.IsDefined(KubernetesSecretType)) + { + writer.WritePropertyName("kubernetesSecretType"u8); + writer.WriteStringValue(KubernetesSecretType.Value.ToString()); + } + if (Optional.IsDefined(ForceSynchronization)) + { + writer.WritePropertyName("forceSynchronization"u8); + writer.WriteStringValue(ForceSynchronization); + } + if (Optional.IsCollectionDefined(ObjectSecretMapping)) + { + writer.WritePropertyName("objectSecretMapping"u8); + writer.WriteStartArray(); + foreach (var item in ObjectSecretMapping) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncUpdateProperties 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(SecretSyncUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncUpdateProperties(document.RootElement, options); + } + + internal static SecretSyncUpdateProperties DeserializeSecretSyncUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretProviderClassName = default; + string serviceAccountName = default; + KubernetesSecretType? kubernetesSecretType = default; + string forceSynchronization = default; + IList objectSecretMapping = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretProviderClassName"u8)) + { + secretProviderClassName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceAccountName"u8)) + { + serviceAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesSecretType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kubernetesSecretType = new KubernetesSecretType(property.Value.GetString()); + continue; + } + if (property.NameEquals("forceSynchronization"u8)) + { + forceSynchronization = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectSecretMapping"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesSecretObjectMapping.DeserializeKubernetesSecretObjectMapping(item, options)); + } + objectSecretMapping = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncUpdateProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs new file mode 100644 index 000000000000..7efa6c10509f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The updatable properties of the SecretSync. + public partial class SecretSyncUpdateProperties + { + /// + /// 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 SecretSyncUpdateProperties() + { + ObjectSecretMapping = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// Keeps track of any properties unknown to the library. + internal SecretSyncUpdateProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType? kubernetesSecretType, string forceSynchronization, IList objectSecretMapping, IDictionary serializedAdditionalRawData) + { + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ForceSynchronization = forceSynchronization; + ObjectSecretMapping = objectSecretMapping; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + public string SecretProviderClassName { get; set; } + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + public string ServiceAccountName { get; set; } + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + public KubernetesSecretType? KubernetesSecretType { get; set; } + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + public string ForceSynchronization { get; set; } + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + public IList ObjectSecretMapping { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/StatusConditionType.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/StatusConditionType.cs new file mode 100644 index 000000000000..811a6bfacddf --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/StatusConditionType.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.SecretsStoreExtension.Models +{ + /// Status conditions types. + public readonly partial struct StatusConditionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StatusConditionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "True"; + private const string FalseValue = "False"; + private const string UnknownValue = "Unknown"; + + /// The status is true. + public static StatusConditionType True { get; } = new StatusConditionType(TrueValue); + /// The status is false. + public static StatusConditionType False { get; } = new StatusConditionType(FalseValue); + /// The status is unknown. + public static StatusConditionType Unknown { get; } = new StatusConditionType(UnknownValue); + /// Determines if two values are the same. + public static bool operator ==(StatusConditionType left, StatusConditionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StatusConditionType left, StatusConditionType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator StatusConditionType(string value) => new StatusConditionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StatusConditionType other && Equals(other); + /// + public bool Equals(StatusConditionType 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ProviderConstants.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..1b9edbef5fd9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs new file mode 100644 index 000000000000..a93f6590ce40 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal partial class AzureKeyVaultSecretProviderClassesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AzureKeyVaultSecretProviderClassesRestOperations. + /// 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 AzureKeyVaultSecretProviderClassesRestOperations(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 ?? "2024-08-21-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AzureKeyVaultSecretProviderClassData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AzureKeyVaultSecretProviderClassData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AzureKeyVaultSecretProviderClassData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AzureKeyVaultSecretProviderClassData.DeserializeAzureKeyVaultSecretProviderClassData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AzureKeyVaultSecretProviderClassData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassPatch 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassPatch 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, 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; + } + + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, 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); + } + } + + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, AzureKeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + _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.SecretSyncController/azureKeyVaultSecretProviderClasses", 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.SecretSyncController/azureKeyVaultSecretProviderClasses", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within a 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within a 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(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.SecretSyncController/azureKeyVaultSecretProviderClasses", 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.SecretSyncController/azureKeyVaultSecretProviderClasses", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within a 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within a 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(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; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs new file mode 100644 index 000000000000..85fe92db2282 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal partial class SecretSyncsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SecretSyncsRestOperations. + /// 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 SecretSyncsRestOperations(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 ?? "2024-08-21-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the properties of a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, secretSyncName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SecretSyncData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SecretSyncData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the properties of a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, secretSyncName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SecretSyncData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SecretSyncData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncData 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncData 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates new or updates a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates new or updates a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, 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 secretSyncName, SecretSyncPatch 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncPatch 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, 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; + } + + /// Updates a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, 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); + } + } + + /// Updates a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, 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 secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, secretSyncName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes a SecretSync instance. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, secretSyncName); + _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.SecretSyncController/secretSyncs", 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.SecretSyncController/secretSyncs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the SecretSync instances within a 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within a 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecretSyncListResult.DeserializeSecretSyncListResult(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.SecretSyncController/secretSyncs", 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.SecretSyncController/secretSyncs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the SecretSync instances within an Azure subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within an Azure subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the SecretSync instances within a 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within a 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecretSyncListResult.DeserializeSecretSyncListResult(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; + } + + /// Lists the SecretSync instances within an Azure subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within an Azure subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.cs new file mode 100644 index 000000000000..90636837d6f8 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.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.SecretsStoreExtension +{ + /// + /// 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 GetSecretSyncs method from an instance of . + /// + public partial class SecretSyncCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _secretSyncClientDiagnostics; + private readonly SecretSyncsRestOperations _secretSyncRestClient; + + /// Initializes a new instance of the class for mocking. + protected SecretSyncCollection() + { + } + + /// 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 SecretSyncCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _secretSyncClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", SecretSyncResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SecretSyncResource.ResourceType, out string secretSyncApiVersion); + _secretSyncRestClient = new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, secretSyncApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Creates new or updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _secretSyncRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Get"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Get"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the SecretSync instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _secretSyncRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _secretSyncRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), _secretSyncClientDiagnostics, Pipeline, "SecretSyncCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _secretSyncRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _secretSyncRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), _secretSyncClientDiagnostics, Pipeline, "SecretSyncCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Exists"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Exists"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.GetIfExists"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs new file mode 100644 index 000000000000..55de2733a1de --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs @@ -0,0 +1,195 @@ +// 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; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class SecretSyncData : 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(SecretSyncData)} 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(ExtendedLocation)) + { + writer.WritePropertyName("extendedLocation"u8); + JsonSerializer.Serialize(writer, ExtendedLocation); + } + } + + SecretSyncData 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(SecretSyncData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncData(document.RootElement, options); + } + + internal static SecretSyncData DeserializeSecretSyncData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SecretSyncProperties properties = default; + ExtendedLocation extendedLocation = 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 = SecretSyncProperties.DeserializeSecretSyncProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("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 SecretSyncData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + 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(SecretSyncData)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretSyncData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs new file mode 100644 index 000000000000..7e2eef8e5d51 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A class representing the SecretSync data model. + /// The SecretSync resource. + /// + public partial class SecretSyncData : 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 SecretSyncData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// + /// Keeps track of any properties unknown to the library. + internal SecretSyncData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SecretSyncProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncData() + { + } + + /// The resource-specific properties for this resource. + public SecretSyncProperties Properties { get; set; } + /// Gets or sets the extended location. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.Serialization.cs new file mode 100644 index 000000000000..f1813c853f61 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.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.SecretsStoreExtension +{ + public partial class SecretSyncResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SecretSyncData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SecretSyncData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs new file mode 100644 index 000000000000..b93aa29c7797 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs @@ -0,0 +1,707 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A Class representing a SecretSync 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 GetSecretSyncResource method. + /// Otherwise you can get one from its parent resource using the GetSecretSync method. + /// + public partial class SecretSyncResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The secretSyncName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string secretSyncName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _secretSyncClientDiagnostics; + private readonly SecretSyncsRestOperations _secretSyncRestClient; + private readonly SecretSyncData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.SecretSyncController/secretSyncs"; + + /// Initializes a new instance of the class for mocking. + protected SecretSyncResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SecretSyncResource(ArmClient client, SecretSyncData 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 SecretSyncResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _secretSyncClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string secretSyncApiVersion); + _secretSyncRestClient = new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, secretSyncApiVersion); +#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 SecretSyncData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Get"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Get"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Delete"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(_secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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; + } + } + + /// + /// Deletes a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Delete"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(_secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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; + } + } + + /// + /// Updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Update + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Update"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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; + } + } + + /// + /// Updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Update + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Update"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Properties/AssemblyInfo.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..c524cff48064 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension.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("SecretsStoreExtension")] diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj new file mode 100644 index 000000000000..59bad16dad6e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.cs new file mode 100644 index 000000000000..7e9627fca2f5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.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.SecretsStoreExtension.Tests +{ + public class SecretsStoreExtensionManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected SecretsStoreExtensionManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected SecretsStoreExtensionManagementTestBase(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs new file mode 100644 index 000000000000..5cf2a0cf0b72 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Tests +{ + public class SecretsStoreExtensionManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml new file mode 100644 index 000000000000..755fd5b9c6a5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/ews/SecretSyncController.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/edgeworkloadsecurity/ci.mgmt.yml b/sdk/edgeworkloadsecurity/ci.mgmt.yml new file mode 100644 index 000000000000..c2472957d0de --- /dev/null +++ b/sdk/edgeworkloadsecurity/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/edgeworkloadsecurity /ci.mgmt.yml + - sdk/edgeworkloadsecurity /Azure.ResourceManager.SecretsStoreExtension / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: edgeworkloadsecurity + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.SecretsStoreExtension + safeName: AzureResourceManagerSecretsStoreExtension diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Azure.ResourceManager.ImpactReporting.sln b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Azure.ResourceManager.ImpactReporting.sln new file mode 100644 index 000000000000..8045641aab8e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Azure.ResourceManager.ImpactReporting.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.ImpactReporting.Samples", "samples\Azure.ResourceManager.ImpactReporting.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ImpactReporting", "src\Azure.ResourceManager.ImpactReporting.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.ImpactReporting.Tests", "tests\Azure.ResourceManager.ImpactReporting.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/impactreporting/Azure.ResourceManager.ImpactReporting/CHANGELOG.md b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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/impactreporting/Azure.ResourceManager.ImpactReporting/Directory.Build.props b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/README.md b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/README.md new file mode 100644 index 000000000000..ab99941d030e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure ImpactReporting 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 ImpactReporting management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.ImpactReporting --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/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.net8.0.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.net8.0.cs new file mode 100644 index 000000000000..4db467f25c36 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.net8.0.cs @@ -0,0 +1,616 @@ +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class ConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ImpactReporting.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ImpactReporting.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string connectorName, 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 connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectorName, 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 ConnectorData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorData() { } + public Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.ConnectorData 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.ImpactReporting.ConnectorData 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 ConnectorResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConnectorResource() { } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) { 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.ImpactReporting.ConnectorData 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.ImpactReporting.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryCollection : Azure.ResourceManager.ArmCollection + { + protected ImpactCategoryCollection() { } + public virtual Azure.Response Exists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string resourceType, string categoryName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string resourceType, string categoryName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryData() { } + public Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.ImpactCategoryData 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.ImpactReporting.ImpactCategoryData 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 ImpactCategoryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ImpactCategoryResource() { } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) { 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.ImpactReporting.ImpactCategoryData 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.ImpactReporting.ImpactCategoryData 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 ImpactReportingExtensions + { + public static Azure.Response GetConnector(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConnectorAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ConnectorResource GetConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ConnectorCollection GetConnectors(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryCollection GetImpactCategories(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetImpactCategory(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetImpactCategoryAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryResource GetImpactCategoryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.InsightResource GetInsightResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWorkloadImpact(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWorkloadImpactAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactResource GetWorkloadImpactResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactCollection GetWorkloadImpacts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + } + public partial class InsightCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InsightCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string insightName, 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 insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string insightName, 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 InsightData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightData() { } + public Azure.ResourceManager.ImpactReporting.Models.InsightProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.InsightData 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.ImpactReporting.InsightData 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 InsightResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InsightResource() { } + public virtual Azure.ResourceManager.ImpactReporting.InsightData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) { 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.ImpactReporting.InsightData 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.ImpactReporting.InsightData 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.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WorkloadImpactCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WorkloadImpactCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workloadImpactName, 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 workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workloadImpactName, 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 WorkloadImpactData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactData() { } + public Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData 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 WorkloadImpactResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WorkloadImpactResource() { } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) { 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 GetInsight(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInsightAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.InsightCollection GetInsights() { throw null; } + Azure.ResourceManager.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.ImpactReporting.Mocking +{ + public partial class MockableImpactReportingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableImpactReportingArmClient() { } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorResource GetConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryResource GetImpactCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.InsightResource GetInsightResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactResource GetWorkloadImpactResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableImpactReportingSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableImpactReportingSubscriptionResource() { } + public virtual Azure.Response GetConnector(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConnectorAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorCollection GetConnectors() { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryCollection GetImpactCategories() { throw null; } + public virtual Azure.Response GetImpactCategory(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetImpactCategoryAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWorkloadImpact(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkloadImpactAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactCollection GetWorkloadImpacts() { throw null; } + } +} +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public static partial class ArmImpactReportingModelFactory + { + public static Azure.ResourceManager.ImpactReporting.ConnectorData ConnectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties ConnectorProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string connectorId = null, string tenantId = null, Azure.ResourceManager.ImpactReporting.Models.Platform connectorType = default(Azure.ResourceManager.ImpactReporting.Models.Platform), System.DateTimeOffset lastRunTimeStamp = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryData ImpactCategoryData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties ImpactCategoryProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string categoryId = null, string parentCategoryId = null, string description = null, System.Collections.Generic.IEnumerable requiredImpactProperties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.InsightData InsightData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.InsightProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.InsightProperties InsightProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string category = null, string status = null, string eventId = null, string groupId = null, Azure.ResourceManager.ImpactReporting.Models.Content content = null, System.DateTimeOffset? eventOn = default(System.DateTimeOffset?), string insightUniqueId = null, Azure.ResourceManager.ImpactReporting.Models.ImpactDetails impact = null, Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails additionalDetails = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.RequiredImpactProperties RequiredImpactProperties(string name = null, System.Collections.Generic.IEnumerable allowedValues = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactData WorkloadImpactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties WorkloadImpactProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string impactedResourceId = null, string impactUniqueId = null, System.DateTimeOffset? reportedTimeUtc = default(System.DateTimeOffset?), string impactCategory = null, string impactDescription = null, System.Collections.Generic.IEnumerable armCorrelationIds = null, System.Collections.Generic.IEnumerable performance = null, Azure.ResourceManager.ImpactReporting.Models.Connectivity connectivity = null, Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties errorDetails = null, Azure.ResourceManager.ImpactReporting.Models.Workload workload = null, string impactGroupId = null, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel? confidenceLevel = default(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel?), Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails clientIncidentDetails = null) { throw null; } + } + public partial class ClientIncidentDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ClientIncidentDetails() { } + public string ClientIncidentId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.IncidentSource? ClientIncidentSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails 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.ImpactReporting.Models.ClientIncidentDetails 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 ConfidenceLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConfidenceLevel(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel High { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel Low { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel 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.ImpactReporting.Models.ConfidenceLevel left, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel left, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Connectivity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Connectivity() { } + public int? Port { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Protocol? Protocol { get { throw null; } set { } } + public string SourceAzureResourceId { get { throw null; } set { } } + public string TargetAzureResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Connectivity 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.ImpactReporting.Models.Connectivity 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 ConnectorPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorPatch() { } + public Azure.ResourceManager.ImpactReporting.Models.Platform? ConnectorType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch 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.ImpactReporting.Models.ConnectorPatch 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 ConnectorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorProperties(string connectorId, string tenantId, Azure.ResourceManager.ImpactReporting.Models.Platform connectorType, System.DateTimeOffset lastRunTimeStamp) { } + public string ConnectorId { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.Platform ConnectorType { get { throw null; } set { } } + public System.DateTimeOffset LastRunTimeStamp { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties 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.ImpactReporting.Models.ConnectorProperties 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 Content : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Content(string title, string description) { } + public string Description { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Content 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.ImpactReporting.Models.Content 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 ErrorDetailProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDetailProperties() { } + public string ErrorCode { get { throw null; } set { } } + public string ErrorMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties 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.ImpactReporting.Models.ErrorDetailProperties 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 ExpectedValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExpectedValueRange(double min, double max) { } + public double Max { get { throw null; } set { } } + public double Min { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ExpectedValueRange 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.ImpactReporting.Models.ExpectedValueRange 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 ImpactCategoryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryProperties() { } + public string CategoryId { get { throw null; } } + public string Description { get { throw null; } } + public string ParentCategoryId { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredImpactProperties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties 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.ImpactReporting.Models.ImpactCategoryProperties 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 ImpactDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ImpactDetails(string impactedResourceId, System.DateTimeOffset startOn, string impactId) { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactId { get { throw null; } set { } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ImpactDetails 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.ImpactReporting.Models.ImpactDetails 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 IncidentSource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public IncidentSource(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource AzureDevops { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource ICM { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource Jira { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource ServiceNow { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.IncidentSource 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.ImpactReporting.Models.IncidentSource left, Azure.ResourceManager.ImpactReporting.Models.IncidentSource right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.IncidentSource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.IncidentSource left, Azure.ResourceManager.ImpactReporting.Models.IncidentSource right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InsightProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightProperties(string category, Azure.ResourceManager.ImpactReporting.Models.Content content, string insightUniqueId, Azure.ResourceManager.ImpactReporting.Models.ImpactDetails impact) { } + public Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails AdditionalDetails { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Content Content { get { throw null; } set { } } + public string EventId { get { throw null; } set { } } + public System.DateTimeOffset? EventOn { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ImpactDetails Impact { get { throw null; } set { } } + public string InsightUniqueId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string Status { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.InsightProperties 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.ImpactReporting.Models.InsightProperties 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 InsightPropertiesAdditionalDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightPropertiesAdditionalDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails 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.ImpactReporting.Models.InsightPropertiesAdditionalDetails 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 MetricUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MetricUnit(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Bytes { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit ByteSeconds { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit BytesPerSecond { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Cores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Count { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit CountPerSecond { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit MilliCores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit MilliSeconds { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit NanoCores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Percent { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Seconds { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.MetricUnit 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.ImpactReporting.Models.MetricUnit left, Azure.ResourceManager.ImpactReporting.Models.MetricUnit right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.MetricUnit (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.MetricUnit left, Azure.ResourceManager.ImpactReporting.Models.MetricUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Performance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Performance() { } + public double? Actual { get { throw null; } set { } } + public double? Expected { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ExpectedValueRange ExpectedValueRange { get { throw null; } set { } } + public string MetricName { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.MetricUnit? Unit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Performance 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.ImpactReporting.Models.Performance 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 Platform : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Platform(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Platform AzureMonitor { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Platform 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.ImpactReporting.Models.Platform left, Azure.ResourceManager.ImpactReporting.Models.Platform right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Platform (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Platform left, Azure.ResourceManager.ImpactReporting.Models.Platform right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Protocol : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Protocol(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol FTP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol HTTP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol HTTPS { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol RDP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol SSH { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol TCP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol UDP { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Protocol 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.ImpactReporting.Models.Protocol left, Azure.ResourceManager.ImpactReporting.Models.Protocol right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Protocol (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Protocol left, Azure.ResourceManager.ImpactReporting.Models.Protocol right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState left, Azure.ResourceManager.ImpactReporting.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState left, Azure.ResourceManager.ImpactReporting.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequiredImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequiredImpactProperties() { } + public System.Collections.Generic.IReadOnlyList AllowedValues { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.RequiredImpactProperties 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.ImpactReporting.Models.RequiredImpactProperties 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 Toolset : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Toolset(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Ansible { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset ARM { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Chef { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Portal { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Puppet { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset SDK { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Shell { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Terraform { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Toolset 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.ImpactReporting.Models.Toolset left, Azure.ResourceManager.ImpactReporting.Models.Toolset right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Toolset (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Toolset left, Azure.ResourceManager.ImpactReporting.Models.Toolset right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Workload : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Workload() { } + public string Context { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Toolset? Toolset { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Workload 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.ImpactReporting.Models.Workload 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 WorkloadImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactProperties(System.DateTimeOffset startOn, string impactedResourceId, string impactCategory) { } + public Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get { throw null; } set { } } + public System.Collections.Generic.IList ArmCorrelationIds { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails ClientIncidentDetails { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel? ConfidenceLevel { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Connectivity Connectivity { get { throw null; } set { } } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties ErrorDetails { get { throw null; } set { } } + public string ImpactCategory { get { throw null; } set { } } + public string ImpactDescription { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactGroupId { get { throw null; } set { } } + public string ImpactUniqueId { get { throw null; } } + public System.Collections.Generic.IList Performance { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset? ReportedTimeUtc { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Workload Workload { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties 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.ImpactReporting.Models.WorkloadImpactProperties 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 WorkloadImpactPropertiesAdditionalProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactPropertiesAdditionalProperties() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties 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.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties 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/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.netstandard2.0.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.netstandard2.0.cs new file mode 100644 index 000000000000..4db467f25c36 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/api/Azure.ResourceManager.ImpactReporting.netstandard2.0.cs @@ -0,0 +1,616 @@ +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class ConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ImpactReporting.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.ImpactReporting.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string connectorName, 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 connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectorName, 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 ConnectorData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorData() { } + public Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.ConnectorData 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.ImpactReporting.ConnectorData 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 ConnectorResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConnectorResource() { } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) { 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.ImpactReporting.ConnectorData 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.ImpactReporting.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryCollection : Azure.ResourceManager.ArmCollection + { + protected ImpactCategoryCollection() { } + public virtual Azure.Response Exists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string resourceType, string categoryName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string resourceType, string categoryName = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryData() { } + public Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.ImpactCategoryData 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.ImpactReporting.ImpactCategoryData 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 ImpactCategoryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ImpactCategoryResource() { } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) { 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.ImpactReporting.ImpactCategoryData 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.ImpactReporting.ImpactCategoryData 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 ImpactReportingExtensions + { + public static Azure.Response GetConnector(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConnectorAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ConnectorResource GetConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ConnectorCollection GetConnectors(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryCollection GetImpactCategories(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetImpactCategory(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetImpactCategoryAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryResource GetImpactCategoryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.InsightResource GetInsightResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWorkloadImpact(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWorkloadImpactAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactResource GetWorkloadImpactResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactCollection GetWorkloadImpacts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + } + public partial class InsightCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InsightCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string insightName, 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 insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string insightName, 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 InsightData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightData() { } + public Azure.ResourceManager.ImpactReporting.Models.InsightProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.InsightData 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.ImpactReporting.InsightData 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 InsightResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InsightResource() { } + public virtual Azure.ResourceManager.ImpactReporting.InsightData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) { 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.ImpactReporting.InsightData 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.ImpactReporting.InsightData 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.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ImpactReporting.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WorkloadImpactCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WorkloadImpactCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workloadImpactName, 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 workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workloadImpactName, 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 WorkloadImpactData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactData() { } + public Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData 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 WorkloadImpactResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WorkloadImpactResource() { } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) { 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 GetInsight(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInsightAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.InsightCollection GetInsights() { throw null; } + Azure.ResourceManager.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData 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.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.ImpactReporting.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.ImpactReporting.Mocking +{ + public partial class MockableImpactReportingArmClient : Azure.ResourceManager.ArmResource + { + protected MockableImpactReportingArmClient() { } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorResource GetConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryResource GetImpactCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.InsightResource GetInsightResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactResource GetWorkloadImpactResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableImpactReportingSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableImpactReportingSubscriptionResource() { } + public virtual Azure.Response GetConnector(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConnectorAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ConnectorCollection GetConnectors() { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.ImpactCategoryCollection GetImpactCategories() { throw null; } + public virtual Azure.Response GetImpactCategory(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetImpactCategoryAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWorkloadImpact(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkloadImpactAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ImpactReporting.WorkloadImpactCollection GetWorkloadImpacts() { throw null; } + } +} +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public static partial class ArmImpactReportingModelFactory + { + public static Azure.ResourceManager.ImpactReporting.ConnectorData ConnectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties ConnectorProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string connectorId = null, string tenantId = null, Azure.ResourceManager.ImpactReporting.Models.Platform connectorType = default(Azure.ResourceManager.ImpactReporting.Models.Platform), System.DateTimeOffset lastRunTimeStamp = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.ImpactReporting.ImpactCategoryData ImpactCategoryData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties ImpactCategoryProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string categoryId = null, string parentCategoryId = null, string description = null, System.Collections.Generic.IEnumerable requiredImpactProperties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.InsightData InsightData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.InsightProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.InsightProperties InsightProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), string category = null, string status = null, string eventId = null, string groupId = null, Azure.ResourceManager.ImpactReporting.Models.Content content = null, System.DateTimeOffset? eventOn = default(System.DateTimeOffset?), string insightUniqueId = null, Azure.ResourceManager.ImpactReporting.Models.ImpactDetails impact = null, Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails additionalDetails = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.RequiredImpactProperties RequiredImpactProperties(string name = null, System.Collections.Generic.IEnumerable allowedValues = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.WorkloadImpactData WorkloadImpactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties properties = null) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties WorkloadImpactProperties(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState?), System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string impactedResourceId = null, string impactUniqueId = null, System.DateTimeOffset? reportedTimeUtc = default(System.DateTimeOffset?), string impactCategory = null, string impactDescription = null, System.Collections.Generic.IEnumerable armCorrelationIds = null, System.Collections.Generic.IEnumerable performance = null, Azure.ResourceManager.ImpactReporting.Models.Connectivity connectivity = null, Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties errorDetails = null, Azure.ResourceManager.ImpactReporting.Models.Workload workload = null, string impactGroupId = null, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel? confidenceLevel = default(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel?), Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails clientIncidentDetails = null) { throw null; } + } + public partial class ClientIncidentDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ClientIncidentDetails() { } + public string ClientIncidentId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.IncidentSource? ClientIncidentSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails 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.ImpactReporting.Models.ClientIncidentDetails 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 ConfidenceLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConfidenceLevel(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel High { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel Low { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel 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.ImpactReporting.Models.ConfidenceLevel left, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel left, Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Connectivity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Connectivity() { } + public int? Port { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Protocol? Protocol { get { throw null; } set { } } + public string SourceAzureResourceId { get { throw null; } set { } } + public string TargetAzureResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Connectivity 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.ImpactReporting.Models.Connectivity 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 ConnectorPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorPatch() { } + public Azure.ResourceManager.ImpactReporting.Models.Platform? ConnectorType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ConnectorPatch 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.ImpactReporting.Models.ConnectorPatch 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 ConnectorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorProperties(string connectorId, string tenantId, Azure.ResourceManager.ImpactReporting.Models.Platform connectorType, System.DateTimeOffset lastRunTimeStamp) { } + public string ConnectorId { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.Platform ConnectorType { get { throw null; } set { } } + public System.DateTimeOffset LastRunTimeStamp { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ConnectorProperties 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.ImpactReporting.Models.ConnectorProperties 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 Content : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Content(string title, string description) { } + public string Description { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Content 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.ImpactReporting.Models.Content 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 ErrorDetailProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDetailProperties() { } + public string ErrorCode { get { throw null; } set { } } + public string ErrorMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties 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.ImpactReporting.Models.ErrorDetailProperties 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 ExpectedValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExpectedValueRange(double min, double max) { } + public double Max { get { throw null; } set { } } + public double Min { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ExpectedValueRange 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.ImpactReporting.Models.ExpectedValueRange 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 ImpactCategoryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryProperties() { } + public string CategoryId { get { throw null; } } + public string Description { get { throw null; } } + public string ParentCategoryId { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredImpactProperties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ImpactCategoryProperties 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.ImpactReporting.Models.ImpactCategoryProperties 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 ImpactDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ImpactDetails(string impactedResourceId, System.DateTimeOffset startOn, string impactId) { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactId { get { throw null; } set { } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.ImpactDetails 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.ImpactReporting.Models.ImpactDetails 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 IncidentSource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public IncidentSource(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource AzureDevops { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource ICM { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource Jira { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.IncidentSource ServiceNow { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.IncidentSource 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.ImpactReporting.Models.IncidentSource left, Azure.ResourceManager.ImpactReporting.Models.IncidentSource right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.IncidentSource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.IncidentSource left, Azure.ResourceManager.ImpactReporting.Models.IncidentSource right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InsightProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightProperties(string category, Azure.ResourceManager.ImpactReporting.Models.Content content, string insightUniqueId, Azure.ResourceManager.ImpactReporting.Models.ImpactDetails impact) { } + public Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails AdditionalDetails { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Content Content { get { throw null; } set { } } + public string EventId { get { throw null; } set { } } + public System.DateTimeOffset? EventOn { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ImpactDetails Impact { get { throw null; } set { } } + public string InsightUniqueId { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string Status { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.InsightProperties 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.ImpactReporting.Models.InsightProperties 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 InsightPropertiesAdditionalDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightPropertiesAdditionalDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.InsightPropertiesAdditionalDetails 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.ImpactReporting.Models.InsightPropertiesAdditionalDetails 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 MetricUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MetricUnit(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Bytes { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit ByteSeconds { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit BytesPerSecond { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Cores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Count { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit CountPerSecond { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit MilliCores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit MilliSeconds { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit NanoCores { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Percent { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.MetricUnit Seconds { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.MetricUnit 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.ImpactReporting.Models.MetricUnit left, Azure.ResourceManager.ImpactReporting.Models.MetricUnit right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.MetricUnit (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.MetricUnit left, Azure.ResourceManager.ImpactReporting.Models.MetricUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Performance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Performance() { } + public double? Actual { get { throw null; } set { } } + public double? Expected { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ExpectedValueRange ExpectedValueRange { get { throw null; } set { } } + public string MetricName { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.MetricUnit? Unit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Performance 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.ImpactReporting.Models.Performance 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 Platform : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Platform(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Platform AzureMonitor { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Platform 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.ImpactReporting.Models.Platform left, Azure.ResourceManager.ImpactReporting.Models.Platform right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Platform (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Platform left, Azure.ResourceManager.ImpactReporting.Models.Platform right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Protocol : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Protocol(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol FTP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol HTTP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol HTTPS { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol RDP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol SSH { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol TCP { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Protocol UDP { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Protocol 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.ImpactReporting.Models.Protocol left, Azure.ResourceManager.ImpactReporting.Models.Protocol right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Protocol (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Protocol left, Azure.ResourceManager.ImpactReporting.Models.Protocol right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState left, Azure.ResourceManager.ImpactReporting.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.ProvisioningState left, Azure.ResourceManager.ImpactReporting.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequiredImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequiredImpactProperties() { } + public System.Collections.Generic.IReadOnlyList AllowedValues { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.RequiredImpactProperties 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.ImpactReporting.Models.RequiredImpactProperties 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 Toolset : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Toolset(string value) { throw null; } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Ansible { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset ARM { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Chef { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Other { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Portal { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Puppet { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset SDK { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Shell { get { throw null; } } + public static Azure.ResourceManager.ImpactReporting.Models.Toolset Terraform { get { throw null; } } + public bool Equals(Azure.ResourceManager.ImpactReporting.Models.Toolset 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.ImpactReporting.Models.Toolset left, Azure.ResourceManager.ImpactReporting.Models.Toolset right) { throw null; } + public static implicit operator Azure.ResourceManager.ImpactReporting.Models.Toolset (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ImpactReporting.Models.Toolset left, Azure.ResourceManager.ImpactReporting.Models.Toolset right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Workload : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Workload() { } + public string Context { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Toolset? Toolset { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.Workload 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.ImpactReporting.Models.Workload 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 WorkloadImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactProperties(System.DateTimeOffset startOn, string impactedResourceId, string impactCategory) { } + public Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get { throw null; } set { } } + public System.Collections.Generic.IList ArmCorrelationIds { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ClientIncidentDetails ClientIncidentDetails { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ConfidenceLevel? ConfidenceLevel { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Connectivity Connectivity { get { throw null; } set { } } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.ErrorDetailProperties ErrorDetails { get { throw null; } set { } } + public string ImpactCategory { get { throw null; } set { } } + public string ImpactDescription { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactGroupId { get { throw null; } set { } } + public string ImpactUniqueId { get { throw null; } } + public System.Collections.Generic.IList Performance { get { throw null; } } + public Azure.ResourceManager.ImpactReporting.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset? ReportedTimeUtc { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + public Azure.ResourceManager.ImpactReporting.Models.Workload Workload { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactProperties 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.ImpactReporting.Models.WorkloadImpactProperties 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 WorkloadImpactPropertiesAdditionalProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactPropertiesAdditionalProperties() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties 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.ImpactReporting.Models.WorkloadImpactPropertiesAdditionalProperties 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/impactreporting/Azure.ResourceManager.ImpactReporting/assets.json b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/assets.json new file mode 100644 index 000000000000..547ee1975d7d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/impactreporting/Azure.ResourceManager.ImpactReporting", + "Tag": "" +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Azure.ResourceManager.ImpactReporting.Samples.csproj b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Azure.ResourceManager.ImpactReporting.Samples.csproj new file mode 100644 index 000000000000..01724b6d9e57 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Azure.ResourceManager.ImpactReporting.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorCollection.cs new file mode 100644 index 000000000000..269ee514ecfb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorCollection.cs @@ -0,0 +1,191 @@ +// 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.ImpactReporting.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_ConnectorCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ConnectorsCreateOrUpdate() + { + // Generated from example definition: 2024-05-01-preview/Connectors_CreateOrUpdate.json + // this example is just showing the usage of "Connector_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + ConnectorData data = new ConnectorData + { + Properties = new ConnectorProperties(null, null, Platform.AzureMonitor, default), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, connectorName, data); + ConnectorResource 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 + ConnectorData 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_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + ConnectorResource result = await collection.GetAsync(connectorName); + + // 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 + ConnectorData 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_ConnectorsListBySubscription() + { + // Generated from example definition: 2024-05-01-preview/Connectors_ListBySubscription.json + // this example is just showing the usage of "Connector_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 = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation and iterate over the result + await foreach (ConnectorResource 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 + ConnectorData 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_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + bool result = await collection.ExistsAsync(connectorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + NullableResponse response = await collection.GetIfExistsAsync(connectorName); + ConnectorResource 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 + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorResource.cs new file mode 100644 index 000000000000..efc8966b25cf --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ConnectorResource.cs @@ -0,0 +1,106 @@ +// 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.ImpactReporting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_ConnectorResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_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 ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + ConnectorResource result = await connector.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 + ConnectorData 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_ConnectorsDelete() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Delete.json + // this example is just showing the usage of "Connector_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 ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "8F74B371-8573-4773-9BDA-D546505BDB3A"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + await connector.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ConnectorsUpdate() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Update.json + // this example is just showing the usage of "Connector_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 ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + ConnectorPatch patch = new ConnectorPatch + { + ConnectorType = Platform.AzureMonitor, + }; + ConnectorResource result = await connector.UpdateAsync(patch); + + // 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 + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs new file mode 100644 index 000000000000..65a75ca469b4 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs @@ -0,0 +1,154 @@ +// 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.ImpactReporting.Samples +{ + public partial class Sample_ImpactCategoryCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + ImpactCategoryResource result = await collection.GetAsync(impactCategoryName); + + // 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 + ImpactCategoryData 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_GetImpactCategoriesListBySubscription() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_ListBySubscription.json + // this example is just showing the usage of "ImpactCategory_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation and iterate over the result + string resourceType = "microsoft.compute/virtualmachines"; + await foreach (ImpactCategoryResource item in collection.GetAllAsync(resourceType)) + { + // 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 + ImpactCategoryData 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_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + bool result = await collection.ExistsAsync(impactCategoryName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + NullableResponse response = await collection.GetIfExistsAsync(impactCategoryName); + ImpactCategoryResource 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 + ImpactCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryResource.cs new file mode 100644 index 000000000000..1764be354dc9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_ImpactCategoryResource.cs @@ -0,0 +1,47 @@ +// 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.ImpactReporting.Samples +{ + public partial class Sample_ImpactCategoryResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_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 ImpactCategoryResource created on azure + // for more information of creating ImpactCategoryResource, please refer to the document of ImpactCategoryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string impactCategoryName = "ARMOperation.Create"; + ResourceIdentifier impactCategoryResourceId = ImpactCategoryResource.CreateResourceIdentifier(subscriptionId, impactCategoryName); + ImpactCategoryResource impactCategory = client.GetImpactCategoryResource(impactCategoryResourceId); + + // invoke the operation + ImpactCategoryResource result = await impactCategory.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 + ImpactCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightCollection.cs new file mode 100644 index 000000000000..38c33592e5bf --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightCollection.cs @@ -0,0 +1,405 @@ +// 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.ImpactReporting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_InsightCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreatingAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Create.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightId12"; + InsightData data = new InsightData + { + Properties = new InsightProperties("repair", new Content("Impact Has been correlated to an outage", "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.
We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
"), "00000000-0000-0000-0000-000000000000", new ImpactDetails("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername", DateTimeOffset.Parse("2023-06-15T01:00:00.009223Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22")) + { + Status = "resolved", + EventOn = DateTimeOffset.Parse("2023-06-15T04:00:00.009223Z"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, insightName, data); + InsightResource 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 + InsightData 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_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + InsightResource result = await collection.GetAsync(insightName); + + // 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 + InsightData 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_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + InsightResource result = await collection.GetAsync(insightName); + + // 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 + InsightData 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_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + InsightResource result = await collection.GetAsync(insightName); + + // 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 + InsightData 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_ListInsightResourcesByWorkloadImpactName() + { + // Generated from example definition: 2024-05-01-preview/Insights_ListBySubscription.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation and iterate over the result + await foreach (InsightResource 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 + InsightData 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_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightResource.cs new file mode 100644 index 000000000000..a5e82a2cd079 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_InsightResource.cs @@ -0,0 +1,174 @@ +// 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.ImpactReporting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_InsightResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + string insightName = "insight1"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData 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_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + string insightName = "HPCUASucceeded"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData 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_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + string insightName = "insightname"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData 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_DeleteAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Delete.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + string insightName = "insightId12"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + await insight.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreatingAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Create.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + string insightName = "insightId12"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightData data = new InsightData + { + Properties = new InsightProperties("repair", new Content("Impact Has been correlated to an outage", "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.
We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
"), "00000000-0000-0000-0000-000000000000", new ImpactDetails("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername", DateTimeOffset.Parse("2023-06-15T01:00:00.009223Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22")) + { + Status = "resolved", + EventOn = DateTimeOffset.Parse("2023-06-15T04:00:00.009223Z"), + }, + }; + ArmOperation lro = await insight.UpdateAsync(WaitUntil.Completed, data); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs new file mode 100644 index 000000000000..6520c4244a99 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs @@ -0,0 +1,368 @@ +// 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.ImpactReporting.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_WorkloadImpactCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingArmOperationFailure() + { + // Generated from example definition: 2024-05-01-preview/WorkloadArmOperation_create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "ArmOperation") + { + ImpactDescription = "deletion of resource failed", + ArmCorrelationIds = { "00000000-0000-0000-0000-000000000000" }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingAvailabilityRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadAvailability_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Availability") + { + ImpactDescription = "read calls failed", + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingAConnectivityImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadConnectivityImpact_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Connectivity") + { + ImpactDescription = "conection failure", + Connectivity = new Connectivity + { + Protocol = Protocol.TCP, + Port = 1443, + SourceAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1", + TargetAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2", + }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingPerformanceRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadPerformance_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Performance") + { + ImpactDescription = "high cpu utilization", + Performance = {new Performance +{ +MetricName = "CPU", +Expected = 60, +Actual = 90, +}}, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData 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_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + WorkloadImpactResource result = await collection.GetAsync(workloadImpactName); + + // 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 + WorkloadImpactData 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_ListWorkloadImpactResourcesBySubscription() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpacts_ListBySubscription.json + // this example is just showing the usage of "WorkloadImpact_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation and iterate over the result + await foreach (WorkloadImpactResource 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 + WorkloadImpactData 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_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + bool result = await collection.ExistsAsync(workloadImpactName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + NullableResponse response = await collection.GetIfExistsAsync(workloadImpactName); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactResource.cs new file mode 100644 index 000000000000..6bab7d41a76f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/samples/Generated/Samples/Sample_WorkloadImpactResource.cs @@ -0,0 +1,275 @@ +// 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.ImpactReporting.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.ImpactReporting.Samples +{ + public partial class Sample_WorkloadImpactResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactResource result = await workloadImpact.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 + WorkloadImpactData 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_DeleteWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Delete.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + await workloadImpact.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingArmOperationFailure() + { + // Generated from example definition: 2024-05-01-preview/WorkloadArmOperation_create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "ArmOperation") + { + ImpactDescription = "deletion of resource failed", + ArmCorrelationIds = { "00000000-0000-0000-0000-000000000000" }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingAvailabilityRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadAvailability_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Availability") + { + ImpactDescription = "read calls failed", + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingAConnectivityImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadConnectivityImpact_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Connectivity") + { + ImpactDescription = "conection failure", + Connectivity = new Connectivity + { + Protocol = Protocol.TCP, + Port = 1443, + SourceAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1", + TargetAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2", + }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingPerformanceRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadPerformance_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Performance") + { + ImpactDescription = "high cpu utilization", + Performance = {new Performance +{ +MetricName = "CPU", +Expected = 60, +Actual = 90, +}}, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Azure.ResourceManager.ImpactReporting.csproj b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Azure.ResourceManager.ImpactReporting.csproj new file mode 100644 index 000000000000..5a6d51438445 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Azure.ResourceManager.ImpactReporting.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider ImpactReporting. + 1.0.0-beta.1 + azure;management;arm;resource manager;impactreporting + Azure.ResourceManager.ImpactReporting + + diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ArmImpactReportingModelFactory.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ArmImpactReportingModelFactory.cs new file mode 100644 index 000000000000..b3c9fbc3798b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ArmImpactReportingModelFactory.cs @@ -0,0 +1,213 @@ +// 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.ImpactReporting.Models +{ + /// Model factory for models. + public static partial class ArmImpactReportingModelFactory + { + /// 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 ConnectorData ConnectorData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ConnectorProperties properties = null) + { + return new ConnectorData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + /// A new instance for mocking. + public static ConnectorProperties ConnectorProperties(ProvisioningState? provisioningState = null, string connectorId = null, string tenantId = null, Platform connectorType = default, DateTimeOffset lastRunTimeStamp = default) + { + return new ConnectorProperties( + provisioningState, + connectorId, + tenantId, + connectorType, + lastRunTimeStamp, + 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 InsightData InsightData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, InsightProperties properties = null) + { + return new InsightData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// category of the insight. + /// status of the insight. example resolved, repaired, other. + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + /// Identifier that can be used to group similar insights. + /// Contains title & description for the insight. + /// Time of the event, which has been correlated the impact. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// additional details of the insight. + /// A new instance for mocking. + public static InsightProperties InsightProperties(ProvisioningState? provisioningState = null, string category = null, string status = null, string eventId = null, string groupId = null, Content content = null, DateTimeOffset? eventOn = null, string insightUniqueId = null, ImpactDetails impact = null, InsightPropertiesAdditionalDetails additionalDetails = null) + { + return new InsightProperties( + provisioningState, + category, + status, + eventId, + groupId, + content, + eventOn, + insightUniqueId, + impact, + additionalDetails, + 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 ImpactCategoryData ImpactCategoryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ImpactCategoryProperties properties = null) + { + return new ImpactCategoryData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Unique ID of the category. + /// Unique ID of the parent category. + /// Description of the category. + /// The workloadImpact properties which are required when reporting with the impact category. + /// A new instance for mocking. + public static ImpactCategoryProperties ImpactCategoryProperties(ProvisioningState? provisioningState = null, string categoryId = null, string parentCategoryId = null, string description = null, IEnumerable requiredImpactProperties = null) + { + requiredImpactProperties ??= new List(); + + return new ImpactCategoryProperties( + provisioningState, + categoryId, + parentCategoryId, + description, + requiredImpactProperties?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the property. + /// Allowed values values for the property. + /// A new instance for mocking. + public static RequiredImpactProperties RequiredImpactProperties(string name = null, IEnumerable allowedValues = null) + { + allowedValues ??= new List(); + + return new RequiredImpactProperties(name, allowedValues?.ToList(), 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 WorkloadImpactData WorkloadImpactData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadImpactProperties properties = null) + { + return new WorkloadImpactData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Time at which impact was observed. + /// Time at which impact has ended. + /// Azure resource id of the impacted resource. + /// Unique ID of the impact (UUID). + /// Time at which impact is reported. + /// Category of the impact, details can found from /impactCategories API. + /// A detailed description of the impact. + /// The ARM correlation ids, this is important field for control plane related impacts. + /// Details about performance issue. Applicable for performance impacts. + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + /// ARM error code and error message associated with the impact. + /// Information about the impacted workload. + /// Use this field to group impacts. + /// Degree of confidence on the impact being a platform issue. + /// Client incident details ex: incidentId , incident source. + /// A new instance for mocking. + public static WorkloadImpactProperties WorkloadImpactProperties(ProvisioningState? provisioningState = null, DateTimeOffset startOn = default, DateTimeOffset? endOn = null, string impactedResourceId = null, string impactUniqueId = null, DateTimeOffset? reportedTimeUtc = null, string impactCategory = null, string impactDescription = null, IEnumerable armCorrelationIds = null, IEnumerable performance = null, Connectivity connectivity = null, WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, ErrorDetailProperties errorDetails = null, Workload workload = null, string impactGroupId = null, ConfidenceLevel? confidenceLevel = null, ClientIncidentDetails clientIncidentDetails = null) + { + armCorrelationIds ??= new List(); + performance ??= new List(); + + return new WorkloadImpactProperties( + provisioningState, + startOn, + endOn, + impactedResourceId, + impactUniqueId, + reportedTimeUtc, + impactCategory, + impactDescription, + armCorrelationIds?.ToList(), + performance?.ToList(), + connectivity, + additionalProperties, + errorDetails, + workload, + impactGroupId, + confidenceLevel, + clientIncidentDetails, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorCollection.cs new file mode 100644 index 000000000000..259c35fa239e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorCollection.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.ImpactReporting +{ + /// + /// 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 GetConnectors method from an instance of . + /// + public partial class ConnectorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _connectorClientDiagnostics; + private readonly ConnectorsRestOperations _connectorRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConnectorCollection() + { + } + + /// 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 ConnectorCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _connectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ConnectorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConnectorResource.ResourceType, out string connectorApiVersion); + _connectorRestClient = new ConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Create a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the connector. + /// 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 connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _connectorRestClient.CreateOrUpdateAsync(Id.SubscriptionId, connectorName, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactReportingArmOperation(new ConnectorOperationSource(Client), _connectorClientDiagnostics, Pipeline, _connectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, connectorName, 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 Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the connector. + /// 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 connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _connectorRestClient.CreateOrUpdate(Id.SubscriptionId, connectorName, data, cancellationToken); + var operation = new ImpactReportingArmOperation(new ConnectorOperationSource(Client), _connectorClientDiagnostics, Pipeline, _connectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Get"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Get"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Connector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors + /// + /// + /// Operation Id + /// Connector_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectorResource(Client, ConnectorData.DeserializeConnectorData(e)), _connectorClientDiagnostics, Pipeline, "ConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Connector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors + /// + /// + /// Operation Id + /// Connector_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectorResource(Client, ConnectorData.DeserializeConnectorData(e)), _connectorClientDiagnostics, Pipeline, "ConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Exists"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Exists"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.Serialization.cs new file mode 100644 index 000000000000..a6b982278d5c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class ConnectorData : 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(ConnectorData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ConnectorData 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(ConnectorData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorData(document.RootElement, options); + } + + internal static ConnectorData DeserializeConnectorData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConnectorProperties 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 = ConnectorProperties.DeserializeConnectorProperties(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 ConnectorData( + 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(ConnectorData)} does not support writing '{options.Format}' format."); + } + } + + ConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.cs new file mode 100644 index 000000000000..b2d1ae438890 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A class representing the Connector data model. + /// A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. + /// + public partial class ConnectorData : 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 ConnectorData() + { + } + + /// 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 ConnectorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectorProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ConnectorProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.Serialization.cs new file mode 100644 index 000000000000..9234dc158038 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.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.ImpactReporting +{ + public partial class ConnectorResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ConnectorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.cs new file mode 100644 index 000000000000..45fb32d37f5e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ConnectorResource.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ImpactReporting.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A Class representing a Connector 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 GetConnectorResource method. + /// Otherwise you can get one from its parent resource using the GetConnector method. + /// + public partial class ConnectorResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The connectorName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _connectorClientDiagnostics; + private readonly ConnectorsRestOperations _connectorRestClient; + private readonly ConnectorData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/connectors"; + + /// Initializes a new instance of the class for mocking. + protected ConnectorResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConnectorResource(ArmClient client, ConnectorData 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 ConnectorResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _connectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string connectorApiVersion); + _connectorRestClient = new ConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectorApiVersion); +#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 ConnectorData 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 Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Get"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Get"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Delete"); + scope.Start(); + try + { + var response = await _connectorRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _connectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Delete"); + scope.Start(); + try + { + var response = _connectorRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var uri = _connectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Update"); + scope.Start(); + try + { + var response = await _connectorRestClient.UpdateAsync(Id.SubscriptionId, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Update"); + scope.Start(); + try + { + var response = _connectorRestClient.Update(Id.SubscriptionId, Id.Name, patch, cancellationToken); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/ImpactReportingExtensions.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/ImpactReportingExtensions.cs new file mode 100644 index 000000000000..63e82bb6e2b0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/ImpactReportingExtensions.cs @@ -0,0 +1,385 @@ +// 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.ImpactReporting.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// A class to add extension methods to Azure.ResourceManager.ImpactReporting. + public static partial class ImpactReportingExtensions + { + private static MockableImpactReportingArmClient GetMockableImpactReportingArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableImpactReportingArmClient(client0)); + } + + private static MockableImpactReportingSubscriptionResource GetMockableImpactReportingSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableImpactReportingSubscriptionResource(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 WorkloadImpactResource GetWorkloadImpactResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactReportingArmClient(client).GetWorkloadImpactResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ImpactCategoryResource GetImpactCategoryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactReportingArmClient(client).GetImpactCategoryResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InsightResource GetInsightResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactReportingArmClient(client).GetInsightResource(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 ConnectorResource GetConnectorResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactReportingArmClient(client).GetConnectorResource(id); + } + + /// + /// Gets a collection of WorkloadImpactResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of WorkloadImpactResources and their operations over a WorkloadImpactResource. + public static WorkloadImpactCollection GetWorkloadImpacts(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetWorkloadImpacts(); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetWorkloadImpactAsync(this SubscriptionResource subscriptionResource, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetWorkloadImpactAsync(workloadImpactName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetWorkloadImpact(this SubscriptionResource subscriptionResource, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetWorkloadImpact(workloadImpactName, cancellationToken); + } + + /// + /// Gets a collection of ImpactCategoryResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ImpactCategoryResources and their operations over a ImpactCategoryResource. + public static ImpactCategoryCollection GetImpactCategories(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetImpactCategories(); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the impact category. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetImpactCategoryAsync(this SubscriptionResource subscriptionResource, string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetImpactCategoryAsync(impactCategoryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the impact category. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetImpactCategory(this SubscriptionResource subscriptionResource, string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetImpactCategory(impactCategoryName, cancellationToken); + } + + /// + /// Gets a collection of ConnectorResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ConnectorResources and their operations over a ConnectorResource. + public static ConnectorCollection GetConnectors(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetConnectors(); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the connector. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetConnectorAsync(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetConnectorAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the connector. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetConnector(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactReportingSubscriptionResource(subscriptionResource).GetConnector(connectorName, cancellationToken); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingArmClient.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingArmClient.cs new file mode 100644 index 000000000000..eb3eaa76ba96 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingArmClient.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableImpactReportingArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableImpactReportingArmClient() + { + } + + /// 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 MockableImpactReportingArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableImpactReportingArmClient(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 WorkloadImpactResource GetWorkloadImpactResource(ResourceIdentifier id) + { + WorkloadImpactResource.ValidateResourceId(id); + return new WorkloadImpactResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ImpactCategoryResource GetImpactCategoryResource(ResourceIdentifier id) + { + ImpactCategoryResource.ValidateResourceId(id); + return new ImpactCategoryResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InsightResource GetInsightResource(ResourceIdentifier id) + { + InsightResource.ValidateResourceId(id); + return new InsightResource(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 ConnectorResource GetConnectorResource(ResourceIdentifier id) + { + ConnectorResource.ValidateResourceId(id); + return new ConnectorResource(Client, id); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingSubscriptionResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingSubscriptionResource.cs new file mode 100644 index 000000000000..65d4b48c48b0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Extensions/MockableImpactReportingSubscriptionResource.cs @@ -0,0 +1,243 @@ +// 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.ImpactReporting.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableImpactReportingSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableImpactReportingSubscriptionResource() + { + } + + /// 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 MockableImpactReportingSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of WorkloadImpactResources in the SubscriptionResource. + /// An object representing collection of WorkloadImpactResources and their operations over a WorkloadImpactResource. + public virtual WorkloadImpactCollection GetWorkloadImpacts() + { + return GetCachedClient(client => new WorkloadImpactCollection(client, Id)); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWorkloadImpactAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + return await GetWorkloadImpacts().GetAsync(workloadImpactName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWorkloadImpact(string workloadImpactName, CancellationToken cancellationToken = default) + { + return GetWorkloadImpacts().Get(workloadImpactName, cancellationToken); + } + + /// Gets a collection of ImpactCategoryResources in the SubscriptionResource. + /// An object representing collection of ImpactCategoryResources and their operations over a ImpactCategoryResource. + public virtual ImpactCategoryCollection GetImpactCategories() + { + return GetCachedClient(client => new ImpactCategoryCollection(client, Id)); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetImpactCategoryAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + return await GetImpactCategories().GetAsync(impactCategoryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetImpactCategory(string impactCategoryName, CancellationToken cancellationToken = default) + { + return GetImpactCategories().Get(impactCategoryName, cancellationToken); + } + + /// Gets a collection of ConnectorResources in the SubscriptionResource. + /// An object representing collection of ConnectorResources and their operations over a ConnectorResource. + public virtual ConnectorCollection GetConnectors() + { + return GetCachedClient(client => new ConnectorCollection(client, Id)); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConnectorAsync(string connectorName, CancellationToken cancellationToken = default) + { + return await GetConnectors().GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConnector(string connectorName, CancellationToken cancellationToken = default) + { + return GetConnectors().Get(connectorName, cancellationToken); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryCollection.cs new file mode 100644 index 000000000000..a3ea25e4ff0f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryCollection.cs @@ -0,0 +1,389 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetImpactCategories method from an instance of . + /// + public partial class ImpactCategoryCollection : ArmCollection + { + private readonly ClientDiagnostics _impactCategoryClientDiagnostics; + private readonly ImpactCategoriesRestOperations _impactCategoryRestClient; + + /// Initializes a new instance of the class for mocking. + protected ImpactCategoryCollection() + { + } + + /// 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 ImpactCategoryCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _impactCategoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ImpactCategoryResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ImpactCategoryResource.ResourceType, out string impactCategoryApiVersion); + _impactCategoryRestClient = new ImpactCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, impactCategoryApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Get"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Get"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List ImpactCategory resources by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories + /// + /// + /// Operation Id + /// ImpactCategory_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Filter by resource type. + /// Filter by category name. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _impactCategoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, resourceType, categoryName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _impactCategoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, resourceType, categoryName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ImpactCategoryResource(Client, ImpactCategoryData.DeserializeImpactCategoryData(e)), _impactCategoryClientDiagnostics, Pipeline, "ImpactCategoryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List ImpactCategory resources by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories + /// + /// + /// Operation Id + /// ImpactCategory_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Filter by resource type. + /// Filter by category name. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => _impactCategoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, resourceType, categoryName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _impactCategoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, resourceType, categoryName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ImpactCategoryResource(Client, ImpactCategoryData.DeserializeImpactCategoryData(e)), _impactCategoryClientDiagnostics, Pipeline, "ImpactCategoryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Exists"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Exists"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.Serialization.cs new file mode 100644 index 000000000000..fd506778bdc5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class ImpactCategoryData : 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(ImpactCategoryData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ImpactCategoryData 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(ImpactCategoryData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryData(document.RootElement, options); + } + + internal static ImpactCategoryData DeserializeImpactCategoryData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ImpactCategoryProperties 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 = ImpactCategoryProperties.DeserializeImpactCategoryProperties(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 ImpactCategoryData( + 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(ImpactCategoryData)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.cs new file mode 100644 index 000000000000..6605b9661ceb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A class representing the ImpactCategory data model. + /// ImpactCategory resource + /// + public partial class ImpactCategoryData : 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 ImpactCategoryData() + { + } + + /// 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 ImpactCategoryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ImpactCategoryProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ImpactCategoryProperties Properties { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.Serialization.cs new file mode 100644 index 000000000000..225490832a38 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.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.ImpactReporting +{ + public partial class ImpactCategoryResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ImpactCategoryData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ImpactCategoryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.cs new file mode 100644 index 000000000000..4d1590547b24 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ImpactCategoryResource.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A Class representing an ImpactCategory along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetImpactCategoryResource method. + /// Otherwise you can get one from its parent resource using the GetImpactCategory method. + /// + public partial class ImpactCategoryResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The impactCategoryName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _impactCategoryClientDiagnostics; + private readonly ImpactCategoriesRestOperations _impactCategoryRestClient; + private readonly ImpactCategoryData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/impactCategories"; + + /// Initializes a new instance of the class for mocking. + protected ImpactCategoryResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ImpactCategoryResource(ArmClient client, ImpactCategoryData 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 ImpactCategoryResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _impactCategoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string impactCategoryApiVersion); + _impactCategoryRestClient = new ImpactCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, impactCategoryApiVersion); +#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 ImpactCategoryData 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 ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryResource.Get"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryResource.Get"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightCollection.cs new file mode 100644 index 000000000000..5f628d8a4a83 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightCollection.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.ImpactReporting +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetInsights method from an instance of . + /// + public partial class InsightCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _insightClientDiagnostics; + private readonly InsightsRestOperations _insightRestClient; + + /// Initializes a new instance of the class for mocking. + protected InsightCollection() + { + } + + /// 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 InsightCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _insightClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", InsightResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InsightResource.ResourceType, out string insightApiVersion); + _insightRestClient = new InsightsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, insightApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkloadImpactResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadImpactResource.ResourceType), nameof(id)); + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the insight. + /// 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 insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _insightRestClient.CreateAsync(Id.SubscriptionId, Id.Name, insightName, data, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Name, insightName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(Response.FromValue(new InsightResource(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 Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the insight. + /// 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 insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _insightRestClient.Create(Id.SubscriptionId, Id.Name, insightName, data, cancellationToken); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Name, insightName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(Response.FromValue(new InsightResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Get"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Get"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Insight resources by workloadImpactName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights + /// + /// + /// Operation Id + /// Insight_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _insightRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _insightRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InsightResource(Client, InsightData.DeserializeInsightData(e)), _insightClientDiagnostics, Pipeline, "InsightCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Insight resources by workloadImpactName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights + /// + /// + /// Operation Id + /// Insight_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _insightRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _insightRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InsightResource(Client, InsightData.DeserializeInsightData(e)), _insightClientDiagnostics, Pipeline, "InsightCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Exists"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Exists"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InsightResource(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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.Serialization.cs new file mode 100644 index 000000000000..62649f4e6be2 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class InsightData : 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(InsightData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + InsightData 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(InsightData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightData(document.RootElement, options); + } + + internal static InsightData DeserializeInsightData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InsightProperties 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 = InsightProperties.DeserializeInsightProperties(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 InsightData( + 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(InsightData)} does not support writing '{options.Format}' format."); + } + } + + InsightData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.cs new file mode 100644 index 000000000000..c5bb97ad25a8 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A class representing the Insight data model. + /// Insight resource + /// + public partial class InsightData : 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 InsightData() + { + } + + /// 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 InsightData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, InsightProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public InsightProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.Serialization.cs new file mode 100644 index 000000000000..c5a59366e0f5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.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.ImpactReporting +{ + public partial class InsightResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + InsightData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + InsightData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.cs new file mode 100644 index 000000000000..c1945374eac6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/InsightResource.cs @@ -0,0 +1,354 @@ +// 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.ImpactReporting +{ + /// + /// A Class representing an Insight along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetInsightResource method. + /// Otherwise you can get one from its parent resource using the GetInsight method. + /// + public partial class InsightResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The workloadImpactName. + /// The insightName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _insightClientDiagnostics; + private readonly InsightsRestOperations _insightRestClient; + private readonly InsightData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/workloadImpacts/insights"; + + /// Initializes a new instance of the class for mocking. + protected InsightResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InsightResource(ArmClient client, InsightData 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 InsightResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _insightClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string insightApiVersion); + _insightRestClient = new InsightsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, insightApiVersion); +#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 InsightData 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 Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Get"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Get"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Delete"); + scope.Start(); + try + { + var response = await _insightRestClient.DeleteAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Delete"); + scope.Start(); + try + { + var response = _insightRestClient.Delete(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _insightRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Update"); + scope.Start(); + try + { + var response = await _insightRestClient.CreateAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(Response.FromValue(new InsightResource(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 Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Update"); + scope.Start(); + try + { + var response = _insightRestClient.Create(Id.SubscriptionId, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(Response.FromValue(new InsightResource(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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Argument.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..8bcc5c0fc004 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..beda10e4a2a1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingList.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..a9c54ec968fb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..ecd60af6d374 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// 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.ImpactReporting +{ + internal static class ModelSerializationExtensions + { + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Optional.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..d987d8b2a49d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..2838ccf740d2 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ConnectorOperationSource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ConnectorOperationSource.cs new file mode 100644 index 000000000000..6da898e4b588 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ConnectorOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal class ConnectorOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConnectorOperationSource(ArmClient client) + { + _client = client; + } + + ConnectorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConnectorData.DeserializeConnectorData(document.RootElement); + return new ConnectorResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConnectorData.DeserializeConnectorData(document.RootElement); + return new ConnectorResource(_client, data); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperation.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperation.cs new file mode 100644 index 000000000000..a7933fad4913 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperation.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.ImpactReporting +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ImpactReportingArmOperation : 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 ImpactReportingArmOperation for mocking. + protected ImpactReportingArmOperation() + { + } + + internal ImpactReportingArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ImpactReportingArmOperation(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, "ImpactReportingArmOperation", 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperationOfT.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperationOfT.cs new file mode 100644 index 000000000000..d8cff351e27f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/ImpactReportingArmOperationOfT.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.ImpactReporting +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ImpactReportingArmOperation : 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 ImpactReportingArmOperation for mocking. + protected ImpactReportingArmOperation() + { + } + + internal ImpactReportingArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ImpactReportingArmOperation(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, "ImpactReportingArmOperation", 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs new file mode 100644 index 000000000000..69a49d409d0c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal class WorkloadImpactOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal WorkloadImpactOperationSource(ArmClient client) + { + _client = client; + } + + WorkloadImpactResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return new WorkloadImpactResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return new WorkloadImpactResource(_client, data); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.Serialization.cs new file mode 100644 index 000000000000..8c173cd99ebe --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.Serialization.cs @@ -0,0 +1,144 @@ +// 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.ImpactReporting.Models +{ + public partial class ClientIncidentDetails : 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(ClientIncidentDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ClientIncidentId)) + { + writer.WritePropertyName("clientIncidentId"u8); + writer.WriteStringValue(ClientIncidentId); + } + if (Optional.IsDefined(ClientIncidentSource)) + { + writer.WritePropertyName("clientIncidentSource"u8); + writer.WriteStringValue(ClientIncidentSource.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ClientIncidentDetails 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(ClientIncidentDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClientIncidentDetails(document.RootElement, options); + } + + internal static ClientIncidentDetails DeserializeClientIncidentDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientIncidentId = default; + IncidentSource? clientIncidentSource = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientIncidentId"u8)) + { + clientIncidentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientIncidentSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientIncidentSource = new IncidentSource(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClientIncidentDetails(clientIncidentId, clientIncidentSource, 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(ClientIncidentDetails)} does not support writing '{options.Format}' format."); + } + } + + ClientIncidentDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClientIncidentDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClientIncidentDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.cs new file mode 100644 index 000000000000..b205106b1f81 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ClientIncidentDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Client incident details ex: incidentId , incident source. + public partial class ClientIncidentDetails + { + /// + /// 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 ClientIncidentDetails() + { + } + + /// Initializes a new instance of . + /// Client incident id. ex : id of the incident created to investigate and address the impact if any. + /// Client incident source. ex : source system name where the incident is created. + /// Keeps track of any properties unknown to the library. + internal ClientIncidentDetails(string clientIncidentId, IncidentSource? clientIncidentSource, IDictionary serializedAdditionalRawData) + { + ClientIncidentId = clientIncidentId; + ClientIncidentSource = clientIncidentSource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Client incident id. ex : id of the incident created to investigate and address the impact if any. + public string ClientIncidentId { get; set; } + /// Client incident source. ex : source system name where the incident is created. + public IncidentSource? ClientIncidentSource { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConfidenceLevel.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConfidenceLevel.cs new file mode 100644 index 000000000000..fc05addd46a7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConfidenceLevel.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.ImpactReporting.Models +{ + /// Degree of confidence on the impact being a platform issue. + public readonly partial struct ConfidenceLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfidenceLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Low confidence on azure being the source of impact. + public static ConfidenceLevel Low { get; } = new ConfidenceLevel(LowValue); + /// Medium confidence on azure being the source of impact. + public static ConfidenceLevel Medium { get; } = new ConfidenceLevel(MediumValue); + /// High confidence on azure being the source of impact. + public static ConfidenceLevel High { get; } = new ConfidenceLevel(HighValue); + /// Determines if two values are the same. + public static bool operator ==(ConfidenceLevel left, ConfidenceLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfidenceLevel left, ConfidenceLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ConfidenceLevel(string value) => new ConfidenceLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfidenceLevel other && Equals(other); + /// + public bool Equals(ConfidenceLevel 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.Serialization.cs new file mode 100644 index 000000000000..215c101124d5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.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.ImpactReporting.Models +{ + public partial class Connectivity : 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(Connectivity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteObjectValue(Source, options); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteObjectValue(Target, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Connectivity 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(Connectivity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivity(document.RootElement, options); + } + + internal static Connectivity DeserializeConnectivity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Protocol? protocol = default; + int? port = default; + SourceOrTarget source = default; + SourceOrTarget target = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new Protocol(property.Value.GetString()); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = SourceOrTarget.DeserializeSourceOrTarget(property.Value, options); + continue; + } + if (property.NameEquals("target"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + target = SourceOrTarget.DeserializeSourceOrTarget(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Connectivity(protocol, port, source, target, 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(Connectivity)} does not support writing '{options.Format}' format."); + } + } + + Connectivity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectivity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Connectivity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.cs new file mode 100644 index 000000000000..84038e4d0ca0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Connectivity.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource could be VM or the network. In such cases, the connectivity field will have the details about both VM and network. + public partial class Connectivity + { + /// + /// 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 Connectivity() + { + } + + /// Initializes a new instance of . + /// Protocol used for the connection. + /// Port number for the connection. + /// Source from which the connection was attempted. + /// target which connection was attempted. + /// Keeps track of any properties unknown to the library. + internal Connectivity(Protocol? protocol, int? port, SourceOrTarget source, SourceOrTarget target, IDictionary serializedAdditionalRawData) + { + Protocol = protocol; + Port = port; + Source = source; + Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Protocol used for the connection. + public Protocol? Protocol { get; set; } + /// Port number for the connection. + public int? Port { get; set; } + /// Source from which the connection was attempted. + internal SourceOrTarget Source { get; set; } + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string SourceAzureResourceId + { + get => Source is null ? default : Source.AzureResourceId; + set + { + if (Source is null) + Source = new SourceOrTarget(); + Source.AzureResourceId = value; + } + } + + /// target which connection was attempted. + internal SourceOrTarget Target { get; set; } + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string TargetAzureResourceId + { + get => Target is null ? default : Target.AzureResourceId; + set + { + if (Target is null) + Target = new SourceOrTarget(); + Target.AzureResourceId = value; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.Serialization.cs new file mode 100644 index 000000000000..f12b3c308064 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.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.ImpactReporting.Models +{ + internal partial class ConnectorListResult : 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(ConnectorListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorListResult 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(ConnectorListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorListResult(document.RootElement, options); + } + + internal static ConnectorListResult DeserializeConnectorListResult(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(ConnectorData.DeserializeConnectorData(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 ConnectorListResult(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(ConnectorListResult)} does not support writing '{options.Format}' format."); + } + } + + ConnectorListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.cs new file mode 100644 index 000000000000..917b75ae474a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorListResult.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.ImpactReporting.Models +{ + /// The response of a Connector list operation. + internal partial class ConnectorListResult + { + /// + /// 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 Connector items on this page. + /// is null. + internal ConnectorListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Connector items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ConnectorListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorListResult() + { + } + + /// The Connector items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.Serialization.cs new file mode 100644 index 000000000000..ab04a90f88cd --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class ConnectorPatch : 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(ConnectorPatch)} does not support writing '{format}' format."); + } + + 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)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorPatch 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(ConnectorPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorPatch(document.RootElement, options); + } + + internal static ConnectorPatch DeserializeConnectorPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConnectorUpdateProperties properties = 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 = ConnectorUpdateProperties.DeserializeConnectorUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorPatch(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(ConnectorPatch)} does not support writing '{options.Format}' format."); + } + } + + ConnectorPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.cs new file mode 100644 index 000000000000..2a13e3d48424 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorPatch.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// The type used for update operations of the Connector. + public partial class ConnectorPatch + { + /// + /// 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 ConnectorPatch() + { + } + + /// Initializes a new instance of . + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ConnectorPatch(ConnectorUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + internal ConnectorUpdateProperties Properties { get; set; } + /// connector type. + public Platform? ConnectorType + { + get => Properties is null ? default : Properties.ConnectorType; + set + { + if (Properties is null) + Properties = new ConnectorUpdateProperties(); + Properties.ConnectorType = value; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.Serialization.cs new file mode 100644 index 000000000000..33c122adc526 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.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.ImpactReporting.Models +{ + public partial class ConnectorProperties : 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(ConnectorProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("connectorId"u8); + writer.WriteStringValue(ConnectorId); + } + if (options.Format != "W") + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + } + writer.WritePropertyName("connectorType"u8); + writer.WriteStringValue(ConnectorType.ToString()); + if (options.Format != "W") + { + writer.WritePropertyName("lastRunTimeStamp"u8); + writer.WriteStringValue(LastRunTimeStamp, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorProperties 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(ConnectorProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorProperties(document.RootElement, options); + } + + internal static ConnectorProperties DeserializeConnectorProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string connectorId = default; + string tenantId = default; + Platform connectorType = default; + DateTimeOffset lastRunTimeStamp = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectorId"u8)) + { + connectorId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectorType"u8)) + { + connectorType = new Platform(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastRunTimeStamp"u8)) + { + lastRunTimeStamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorProperties( + provisioningState, + connectorId, + tenantId, + connectorType, + lastRunTimeStamp, + 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(ConnectorProperties)} does not support writing '{options.Format}' format."); + } + } + + ConnectorProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.cs new file mode 100644 index 000000000000..669e13c50b6a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Details of the Connector. + public partial class ConnectorProperties + { + /// + /// 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 . + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + public ConnectorProperties(string connectorId, string tenantId, Platform connectorType, DateTimeOffset lastRunTimeStamp) + { + ConnectorId = connectorId; + TenantId = tenantId; + ConnectorType = connectorType; + LastRunTimeStamp = lastRunTimeStamp; + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + /// Keeps track of any properties unknown to the library. + internal ConnectorProperties(ProvisioningState? provisioningState, string connectorId, string tenantId, Platform connectorType, DateTimeOffset lastRunTimeStamp, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + ConnectorId = connectorId; + TenantId = tenantId; + ConnectorType = connectorType; + LastRunTimeStamp = lastRunTimeStamp; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// unique id of the connector. + public string ConnectorId { get; } + /// tenant id of this connector. + public string TenantId { get; } + /// connector type. + public Platform ConnectorType { get; set; } + /// last run time stamp of this connector in UTC time zone. + public DateTimeOffset LastRunTimeStamp { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..c07fce958fd7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + internal partial class ConnectorUpdateProperties : 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(ConnectorUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ConnectorType)) + { + writer.WritePropertyName("connectorType"u8); + writer.WriteStringValue(ConnectorType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorUpdateProperties 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(ConnectorUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorUpdateProperties(document.RootElement, options); + } + + internal static ConnectorUpdateProperties DeserializeConnectorUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Platform? connectorType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("connectorType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectorType = new Platform(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorUpdateProperties(connectorType, 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(ConnectorUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + ConnectorUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.cs new file mode 100644 index 000000000000..3521d7cb9e48 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ConnectorUpdateProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// The updatable properties of the Connector. + internal partial class ConnectorUpdateProperties + { + /// + /// 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 ConnectorUpdateProperties() + { + } + + /// Initializes a new instance of . + /// connector type. + /// Keeps track of any properties unknown to the library. + internal ConnectorUpdateProperties(Platform? connectorType, IDictionary serializedAdditionalRawData) + { + ConnectorType = connectorType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// connector type. + public Platform? ConnectorType { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.Serialization.cs new file mode 100644 index 000000000000..842e20eb2605 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class Content : 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(Content)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Content 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(Content)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContent(document.RootElement, options); + } + + internal static Content DeserializeContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string title = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Content(title, description, 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(Content)} does not support writing '{options.Format}' format."); + } + } + + Content IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Content)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.cs new file mode 100644 index 000000000000..e04c8545c8f8 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Content.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Article details of the insight like title, description etc. + public partial class Content + { + /// + /// 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 . + /// Title of the insight. + /// Description of the insight. + /// or is null. + public Content(string title, string description) + { + Argument.AssertNotNull(title, nameof(title)); + Argument.AssertNotNull(description, nameof(description)); + + Title = title; + Description = description; + } + + /// Initializes a new instance of . + /// Title of the insight. + /// Description of the insight. + /// Keeps track of any properties unknown to the library. + internal Content(string title, string description, IDictionary serializedAdditionalRawData) + { + Title = title; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Content() + { + } + + /// Title of the insight. + public string Title { get; set; } + /// Description of the insight. + public string Description { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.Serialization.cs new file mode 100644 index 000000000000..04719b5c05b8 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class ErrorDetailProperties : 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(ErrorDetailProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ErrorCode)) + { + writer.WritePropertyName("errorCode"u8); + writer.WriteStringValue(ErrorCode); + } + if (Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorDetailProperties 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(ErrorDetailProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDetailProperties(document.RootElement, options); + } + + internal static ErrorDetailProperties DeserializeErrorDetailProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string errorCode = default; + string errorMessage = 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorDetailProperties(errorCode, errorMessage, 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(ErrorDetailProperties)} does not support writing '{options.Format}' format."); + } + } + + ErrorDetailProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorDetailProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorDetailProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.cs new file mode 100644 index 000000000000..f6568d77a03e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ErrorDetailProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// ARM error code and error message associated with the impact. + public partial class ErrorDetailProperties + { + /// + /// 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 ErrorDetailProperties() + { + } + + /// Initializes a new instance of . + /// ARM Error code associated with the impact. + /// ARM Error Message associated with the impact. + /// Keeps track of any properties unknown to the library. + internal ErrorDetailProperties(string errorCode, string errorMessage, IDictionary serializedAdditionalRawData) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// ARM Error code associated with the impact. + public string ErrorCode { get; set; } + /// ARM Error Message associated with the impact. + public string ErrorMessage { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.Serialization.cs new file mode 100644 index 000000000000..b52a0c941621 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class ExpectedValueRange : 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(ExpectedValueRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("min"u8); + writer.WriteNumberValue(Min); + writer.WritePropertyName("max"u8); + writer.WriteNumberValue(Max); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExpectedValueRange 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(ExpectedValueRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpectedValueRange(document.RootElement, options); + } + + internal static ExpectedValueRange DeserializeExpectedValueRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double min = default; + double max = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("min"u8)) + { + min = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("max"u8)) + { + max = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpectedValueRange(min, max, 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(ExpectedValueRange)} does not support writing '{options.Format}' format."); + } + } + + ExpectedValueRange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExpectedValueRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpectedValueRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.cs new file mode 100644 index 000000000000..b6de2f1af960 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ExpectedValueRange.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; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Max and Min Threshold values for the metric. + public partial class ExpectedValueRange + { + /// + /// 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 . + /// Min threshold value for the metric. + /// Max threshold value for the metric. + public ExpectedValueRange(double min, double max) + { + Min = min; + Max = max; + } + + /// Initializes a new instance of . + /// Min threshold value for the metric. + /// Max threshold value for the metric. + /// Keeps track of any properties unknown to the library. + internal ExpectedValueRange(double min, double max, IDictionary serializedAdditionalRawData) + { + Min = min; + Max = max; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExpectedValueRange() + { + } + + /// Min threshold value for the metric. + public double Min { get; set; } + /// Max threshold value for the metric. + public double Max { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.Serialization.cs new file mode 100644 index 000000000000..85ce36e635a8 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.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.ImpactReporting.Models +{ + internal partial class ImpactCategoryListResult : 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(ImpactCategoryListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactCategoryListResult 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(ImpactCategoryListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryListResult(document.RootElement, options); + } + + internal static ImpactCategoryListResult DeserializeImpactCategoryListResult(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(ImpactCategoryData.DeserializeImpactCategoryData(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 ImpactCategoryListResult(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(ImpactCategoryListResult)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.cs new file mode 100644 index 000000000000..ba44039d1f6c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryListResult.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.ImpactReporting.Models +{ + /// The response of a ImpactCategory list operation. + internal partial class ImpactCategoryListResult + { + /// + /// 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 ImpactCategory items on this page. + /// is null. + internal ImpactCategoryListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ImpactCategory items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ImpactCategoryListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactCategoryListResult() + { + } + + /// The ImpactCategory items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.Serialization.cs new file mode 100644 index 000000000000..d0768f4ef24a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.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; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class ImpactCategoryProperties : 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(ImpactCategoryProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("categoryId"u8); + writer.WriteStringValue(CategoryId); + if (Optional.IsDefined(ParentCategoryId)) + { + writer.WritePropertyName("parentCategoryId"u8); + writer.WriteStringValue(ParentCategoryId); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(RequiredImpactProperties)) + { + writer.WritePropertyName("requiredImpactProperties"u8); + writer.WriteStartArray(); + foreach (var item in RequiredImpactProperties) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactCategoryProperties 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(ImpactCategoryProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryProperties(document.RootElement, options); + } + + internal static ImpactCategoryProperties DeserializeImpactCategoryProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string categoryId = default; + string parentCategoryId = default; + string description = default; + IReadOnlyList requiredImpactProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("categoryId"u8)) + { + categoryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("parentCategoryId"u8)) + { + parentCategoryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredImpactProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.RequiredImpactProperties.DeserializeRequiredImpactProperties(item, options)); + } + requiredImpactProperties = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactCategoryProperties( + provisioningState, + categoryId, + parentCategoryId, + description, + requiredImpactProperties ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.cs new file mode 100644 index 000000000000..af4c8b3aac08 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactCategoryProperties.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Impact category properties. + public partial class ImpactCategoryProperties + { + /// + /// 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 . + /// Unique ID of the category. + /// is null. + internal ImpactCategoryProperties(string categoryId) + { + Argument.AssertNotNull(categoryId, nameof(categoryId)); + + CategoryId = categoryId; + RequiredImpactProperties = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Unique ID of the category. + /// Unique ID of the parent category. + /// Description of the category. + /// The workloadImpact properties which are required when reporting with the impact category. + /// Keeps track of any properties unknown to the library. + internal ImpactCategoryProperties(ProvisioningState? provisioningState, string categoryId, string parentCategoryId, string description, IReadOnlyList requiredImpactProperties, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + CategoryId = categoryId; + ParentCategoryId = parentCategoryId; + Description = description; + RequiredImpactProperties = requiredImpactProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactCategoryProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// Unique ID of the category. + public string CategoryId { get; } + /// Unique ID of the parent category. + public string ParentCategoryId { get; } + /// Description of the category. + public string Description { get; } + /// The workloadImpact properties which are required when reporting with the impact category. + public IReadOnlyList RequiredImpactProperties { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.Serialization.cs new file mode 100644 index 000000000000..8ed8e267c7be --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + public partial class ImpactDetails : 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(ImpactDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("impactedResourceId"u8); + writer.WriteStringValue(ImpactedResourceId); + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn, "O"); + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + writer.WritePropertyName("impactId"u8); + writer.WriteStringValue(ImpactId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactDetails 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(ImpactDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactDetails(document.RootElement, options); + } + + internal static ImpactDetails DeserializeImpactDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string impactedResourceId = default; + DateTimeOffset startTime = default; + DateTimeOffset? endTime = default; + string impactId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("impactedResourceId"u8)) + { + impactedResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactId"u8)) + { + impactId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactDetails(impactedResourceId, startTime, endTime, impactId, 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(ImpactDetails)} does not support writing '{options.Format}' format."); + } + } + + ImpactDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.cs new file mode 100644 index 000000000000..9c12f1480dc1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ImpactDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// details of of the impact for which insight has been generated. + public partial class ImpactDetails + { + /// + /// 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 . + /// List of impacted Azure resources. + /// Time at which impact was started according to reported impact. + /// Azure Id of the impact. + /// or is null. + public ImpactDetails(string impactedResourceId, DateTimeOffset startOn, string impactId) + { + Argument.AssertNotNull(impactedResourceId, nameof(impactedResourceId)); + Argument.AssertNotNull(impactId, nameof(impactId)); + + ImpactedResourceId = impactedResourceId; + StartOn = startOn; + ImpactId = impactId; + } + + /// Initializes a new instance of . + /// List of impacted Azure resources. + /// Time at which impact was started according to reported impact. + /// Time at which impact was ended according to reported impact. + /// Azure Id of the impact. + /// Keeps track of any properties unknown to the library. + internal ImpactDetails(string impactedResourceId, DateTimeOffset startOn, DateTimeOffset? endOn, string impactId, IDictionary serializedAdditionalRawData) + { + ImpactedResourceId = impactedResourceId; + StartOn = startOn; + EndOn = endOn; + ImpactId = impactId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactDetails() + { + } + + /// List of impacted Azure resources. + public string ImpactedResourceId { get; set; } + /// Time at which impact was started according to reported impact. + public DateTimeOffset StartOn { get; set; } + /// Time at which impact was ended according to reported impact. + public DateTimeOffset? EndOn { get; set; } + /// Azure Id of the impact. + public string ImpactId { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/IncidentSource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/IncidentSource.cs new file mode 100644 index 000000000000..b1a1a24ecc52 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/IncidentSource.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.ImpactReporting.Models +{ + /// List of incident interfaces. + public readonly partial struct IncidentSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IncidentSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureDevopsValue = "AzureDevops"; + private const string ICMValue = "ICM"; + private const string JiraValue = "Jira"; + private const string ServiceNowValue = "ServiceNow"; + private const string OtherValue = "Other"; + + /// When source of Incident is AzureDevops. + public static IncidentSource AzureDevops { get; } = new IncidentSource(AzureDevopsValue); + /// When source of Incident is Microsoft ICM. + public static IncidentSource ICM { get; } = new IncidentSource(ICMValue); + /// When source of Incident is Jira. + public static IncidentSource Jira { get; } = new IncidentSource(JiraValue); + /// When source of Incident is ServiceNow. + public static IncidentSource ServiceNow { get; } = new IncidentSource(ServiceNowValue); + /// When source of Incident is Other. + public static IncidentSource Other { get; } = new IncidentSource(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(IncidentSource left, IncidentSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IncidentSource left, IncidentSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IncidentSource(string value) => new IncidentSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IncidentSource other && Equals(other); + /// + public bool Equals(IncidentSource 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.Serialization.cs new file mode 100644 index 000000000000..cdb456ce6098 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.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.ImpactReporting.Models +{ + internal partial class InsightListResult : 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(InsightListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightListResult 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(InsightListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightListResult(document.RootElement, options); + } + + internal static InsightListResult DeserializeInsightListResult(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(InsightData.DeserializeInsightData(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 InsightListResult(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(InsightListResult)} does not support writing '{options.Format}' format."); + } + } + + InsightListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.cs new file mode 100644 index 000000000000..79f58ae35662 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightListResult.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.ImpactReporting.Models +{ + /// The response of a Insight list operation. + internal partial class InsightListResult + { + /// + /// 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 Insight items on this page. + /// is null. + internal InsightListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Insight items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal InsightListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InsightListResult() + { + } + + /// The Insight items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.Serialization.cs new file mode 100644 index 000000000000..f82688f4dfdf --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.Serialization.cs @@ -0,0 +1,239 @@ +// 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.ImpactReporting.Models +{ + public partial class InsightProperties : 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(InsightProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(EventId)) + { + writer.WritePropertyName("eventId"u8); + writer.WriteStringValue(EventId); + } + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + writer.WritePropertyName("content"u8); + writer.WriteObjectValue(Content, options); + if (Optional.IsDefined(EventOn)) + { + writer.WritePropertyName("eventTime"u8); + writer.WriteStringValue(EventOn.Value, "O"); + } + writer.WritePropertyName("insightUniqueId"u8); + writer.WriteStringValue(InsightUniqueId); + writer.WritePropertyName("impact"u8); + writer.WriteObjectValue(Impact, options); + if (Optional.IsDefined(AdditionalDetails)) + { + writer.WritePropertyName("additionalDetails"u8); + writer.WriteObjectValue(AdditionalDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightProperties 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(InsightProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightProperties(document.RootElement, options); + } + + internal static InsightProperties DeserializeInsightProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string category = default; + string status = default; + string eventId = default; + string groupId = default; + Content content = default; + DateTimeOffset? eventTime = default; + string insightUniqueId = default; + ImpactDetails impact = default; + InsightPropertiesAdditionalDetails additionalDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventId"u8)) + { + eventId = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = Content.DeserializeContent(property.Value, options); + continue; + } + if (property.NameEquals("eventTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("insightUniqueId"u8)) + { + insightUniqueId = property.Value.GetString(); + continue; + } + if (property.NameEquals("impact"u8)) + { + impact = ImpactDetails.DeserializeImpactDetails(property.Value, options); + continue; + } + if (property.NameEquals("additionalDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalDetails = InsightPropertiesAdditionalDetails.DeserializeInsightPropertiesAdditionalDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightProperties( + provisioningState, + category, + status, + eventId, + groupId, + content, + eventTime, + insightUniqueId, + impact, + additionalDetails, + 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(InsightProperties)} does not support writing '{options.Format}' format."); + } + } + + InsightProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.cs new file mode 100644 index 000000000000..e9b3a2c49686 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightProperties.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Impact category properties. + public partial class InsightProperties + { + /// + /// 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 . + /// category of the insight. + /// Contains title & description for the insight. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// , , or is null. + public InsightProperties(string category, Content content, string insightUniqueId, ImpactDetails impact) + { + Argument.AssertNotNull(category, nameof(category)); + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(insightUniqueId, nameof(insightUniqueId)); + Argument.AssertNotNull(impact, nameof(impact)); + + Category = category; + Content = content; + InsightUniqueId = insightUniqueId; + Impact = impact; + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// category of the insight. + /// status of the insight. example resolved, repaired, other. + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + /// Identifier that can be used to group similar insights. + /// Contains title & description for the insight. + /// Time of the event, which has been correlated the impact. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// additional details of the insight. + /// Keeps track of any properties unknown to the library. + internal InsightProperties(ProvisioningState? provisioningState, string category, string status, string eventId, string groupId, Content content, DateTimeOffset? eventOn, string insightUniqueId, ImpactDetails impact, InsightPropertiesAdditionalDetails additionalDetails, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Category = category; + Status = status; + EventId = eventId; + GroupId = groupId; + Content = content; + EventOn = eventOn; + InsightUniqueId = insightUniqueId; + Impact = impact; + AdditionalDetails = additionalDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InsightProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// category of the insight. + public string Category { get; set; } + /// status of the insight. example resolved, repaired, other. + public string Status { get; set; } + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + public string EventId { get; set; } + /// Identifier that can be used to group similar insights. + public string GroupId { get; set; } + /// Contains title & description for the insight. + public Content Content { get; set; } + /// Time of the event, which has been correlated the impact. + public DateTimeOffset? EventOn { get; set; } + /// unique id of the insight. + public string InsightUniqueId { get; set; } + /// details of of the impact for which insight has been generated. + public ImpactDetails Impact { get; set; } + /// additional details of the insight. + public InsightPropertiesAdditionalDetails AdditionalDetails { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs new file mode 100644 index 000000000000..8284690d82b5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs @@ -0,0 +1,118 @@ +// 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.ImpactReporting.Models +{ + public partial class InsightPropertiesAdditionalDetails : 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(InsightPropertiesAdditionalDetails)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightPropertiesAdditionalDetails 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(InsightPropertiesAdditionalDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightPropertiesAdditionalDetails(document.RootElement, options); + } + + internal static InsightPropertiesAdditionalDetails DeserializeInsightPropertiesAdditionalDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightPropertiesAdditionalDetails(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(InsightPropertiesAdditionalDetails)} does not support writing '{options.Format}' format."); + } + } + + InsightPropertiesAdditionalDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightPropertiesAdditionalDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightPropertiesAdditionalDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.cs new file mode 100644 index 000000000000..9c4878c129cf --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/InsightPropertiesAdditionalDetails.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// The InsightPropertiesAdditionalDetails. + public partial class InsightPropertiesAdditionalDetails + { + /// + /// 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 InsightPropertiesAdditionalDetails() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal InsightPropertiesAdditionalDetails(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/MetricUnit.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/MetricUnit.cs new file mode 100644 index 000000000000..0afe0b5c1194 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/MetricUnit.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// List of unit of the metric. + public readonly partial struct MetricUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MetricUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ByteSecondsValue = "ByteSeconds"; + private const string BytesValue = "Bytes"; + private const string BytesPerSecondValue = "BytesPerSecond"; + private const string CoresValue = "Cores"; + private const string CountValue = "Count"; + private const string CountPerSecondValue = "CountPerSecond"; + private const string MilliCoresValue = "MilliCores"; + private const string MilliSecondsValue = "MilliSeconds"; + private const string NanoCoresValue = "NanoCores"; + private const string PercentValue = "Percent"; + private const string SecondsValue = "Seconds"; + private const string OtherValue = "Other"; + + /// When measurement is in ByteSeconds. + public static MetricUnit ByteSeconds { get; } = new MetricUnit(ByteSecondsValue); + /// When measurement is in Bytes. + public static MetricUnit Bytes { get; } = new MetricUnit(BytesValue); + /// When measurement is in BytesPerSecond. + public static MetricUnit BytesPerSecond { get; } = new MetricUnit(BytesPerSecondValue); + /// When measurement is in Cores. + public static MetricUnit Cores { get; } = new MetricUnit(CoresValue); + /// When measurement is in Count. + public static MetricUnit Count { get; } = new MetricUnit(CountValue); + /// When measurement is in CountPerSecond. + public static MetricUnit CountPerSecond { get; } = new MetricUnit(CountPerSecondValue); + /// When measurement is in MilliCores. + public static MetricUnit MilliCores { get; } = new MetricUnit(MilliCoresValue); + /// When measurement is in MilliSeconds. + public static MetricUnit MilliSeconds { get; } = new MetricUnit(MilliSecondsValue); + /// When measurement is in NanoCores. + public static MetricUnit NanoCores { get; } = new MetricUnit(NanoCoresValue); + /// When measurement is in Percent. + public static MetricUnit Percent { get; } = new MetricUnit(PercentValue); + /// When measurement is in Seconds. + public static MetricUnit Seconds { get; } = new MetricUnit(SecondsValue); + /// When measurement is in Other than listed. + public static MetricUnit Other { get; } = new MetricUnit(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(MetricUnit left, MetricUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetricUnit left, MetricUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MetricUnit(string value) => new MetricUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetricUnit other && Equals(other); + /// + public bool Equals(MetricUnit 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.Serialization.cs new file mode 100644 index 000000000000..082e4a6ddffd --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.Serialization.cs @@ -0,0 +1,195 @@ +// 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.ImpactReporting.Models +{ + public partial class Performance : 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(Performance)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MetricName)) + { + writer.WritePropertyName("metricName"u8); + writer.WriteStringValue(MetricName); + } + if (Optional.IsDefined(Expected)) + { + writer.WritePropertyName("expected"u8); + writer.WriteNumberValue(Expected.Value); + } + if (Optional.IsDefined(Actual)) + { + writer.WritePropertyName("actual"u8); + writer.WriteNumberValue(Actual.Value); + } + if (Optional.IsDefined(ExpectedValueRange)) + { + writer.WritePropertyName("expectedValueRange"u8); + writer.WriteObjectValue(ExpectedValueRange, options); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Performance 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(Performance)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePerformance(document.RootElement, options); + } + + internal static Performance DeserializePerformance(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string metricName = default; + double? expected = default; + double? actual = default; + ExpectedValueRange expectedValueRange = default; + MetricUnit? unit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metricName"u8)) + { + metricName = property.Value.GetString(); + continue; + } + if (property.NameEquals("expected"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expected = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("actual"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actual = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("expectedValueRange"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expectedValueRange = ExpectedValueRange.DeserializeExpectedValueRange(property.Value, options); + continue; + } + if (property.NameEquals("unit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unit = new MetricUnit(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Performance( + metricName, + expected, + actual, + expectedValueRange, + unit, + 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(Performance)} does not support writing '{options.Format}' format."); + } + } + + Performance IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePerformance(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Performance)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.cs new file mode 100644 index 000000000000..52de89fe19b3 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Performance.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Details about impacted performance metrics. Applicable for performance related impact. + public partial class Performance + { + /// + /// 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 Performance() + { + } + + /// Initializes a new instance of . + /// Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API. + /// Threshold value for the metric. + /// Observed value for the metric. + /// Max and Min Threshold values for the metric. + /// Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other. + /// Keeps track of any properties unknown to the library. + internal Performance(string metricName, double? expected, double? actual, ExpectedValueRange expectedValueRange, MetricUnit? unit, IDictionary serializedAdditionalRawData) + { + MetricName = metricName; + Expected = expected; + Actual = actual; + ExpectedValueRange = expectedValueRange; + Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API. + public string MetricName { get; set; } + /// Threshold value for the metric. + public double? Expected { get; set; } + /// Observed value for the metric. + public double? Actual { get; set; } + /// Max and Min Threshold values for the metric. + public ExpectedValueRange ExpectedValueRange { get; set; } + /// Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other. + public MetricUnit? Unit { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Platform.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Platform.cs new file mode 100644 index 000000000000..978aaaa0e070 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Platform.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Enum for connector types. + public readonly partial struct Platform : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Platform(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureMonitorValue = "AzureMonitor"; + + /// Type of Azure Monitor. + public static Platform AzureMonitor { get; } = new Platform(AzureMonitorValue); + /// Determines if two values are the same. + public static bool operator ==(Platform left, Platform right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Platform left, Platform right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Platform(string value) => new Platform(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Platform other && Equals(other); + /// + public bool Equals(Platform 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Protocol.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Protocol.cs new file mode 100644 index 000000000000..dd3557f30bfb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Protocol.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// List of protocols. + public readonly partial struct Protocol : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Protocol(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TCPValue = "TCP"; + private const string UDPValue = "UDP"; + private const string HTTPValue = "HTTP"; + private const string HTTPSValue = "HTTPS"; + private const string RDPValue = "RDP"; + private const string FTPValue = "FTP"; + private const string SSHValue = "SSH"; + private const string OtherValue = "Other"; + + /// When communication protocol is TCP. + public static Protocol TCP { get; } = new Protocol(TCPValue); + /// When communication protocol is UDP. + public static Protocol UDP { get; } = new Protocol(UDPValue); + /// When communication protocol is HTTP. + public static Protocol HTTP { get; } = new Protocol(HTTPValue); + /// When communication protocol is HTTPS. + public static Protocol HTTPS { get; } = new Protocol(HTTPSValue); + /// When communication protocol is RDP. + public static Protocol RDP { get; } = new Protocol(RDPValue); + /// When communication protocol is FTP. + public static Protocol FTP { get; } = new Protocol(FTPValue); + /// When communication protocol is SSH. + public static Protocol SSH { get; } = new Protocol(SSHValue); + /// When communication protocol is Other. + public static Protocol Other { get; } = new Protocol(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(Protocol left, Protocol right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Protocol left, Protocol right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Protocol(string value) => new Protocol(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Protocol other && Equals(other); + /// + public bool Equals(Protocol 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ProvisioningState.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..7f8995037fb0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/ProvisioningState.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.ImpactReporting.Models +{ + /// Provisioning state of the resource. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Provisioning Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Provisioning Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Provisioning Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.Serialization.cs new file mode 100644 index 000000000000..2a44e8356530 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.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.ImpactReporting.Models +{ + public partial class RequiredImpactProperties : 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(RequiredImpactProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsCollectionDefined(AllowedValues)) + { + writer.WritePropertyName("allowedValues"u8); + writer.WriteStartArray(); + foreach (var item in AllowedValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RequiredImpactProperties 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(RequiredImpactProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredImpactProperties(document.RootElement, options); + } + + internal static RequiredImpactProperties DeserializeRequiredImpactProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList allowedValues = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedValues = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequiredImpactProperties(name, allowedValues ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support writing '{options.Format}' format."); + } + } + + RequiredImpactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequiredImpactProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.cs new file mode 100644 index 000000000000..53ed7245ccf3 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/RequiredImpactProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Required impact properties. + public partial class RequiredImpactProperties + { + /// + /// 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 . + /// Name of the property. + /// is null. + internal RequiredImpactProperties(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + AllowedValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of the property. + /// Allowed values values for the property. + /// Keeps track of any properties unknown to the library. + internal RequiredImpactProperties(string name, IReadOnlyList allowedValues, IDictionary serializedAdditionalRawData) + { + Name = name; + AllowedValues = allowedValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequiredImpactProperties() + { + } + + /// Name of the property. + public string Name { get; } + /// Allowed values values for the property. + public IReadOnlyList AllowedValues { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.Serialization.cs new file mode 100644 index 000000000000..9aa15d592797 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.Serialization.cs @@ -0,0 +1,129 @@ +// 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.ImpactReporting.Models +{ + internal partial class SourceOrTarget : 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(SourceOrTarget)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AzureResourceId)) + { + writer.WritePropertyName("azureResourceId"u8); + writer.WriteStringValue(AzureResourceId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SourceOrTarget 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(SourceOrTarget)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSourceOrTarget(document.RootElement, options); + } + + internal static SourceOrTarget DeserializeSourceOrTarget(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string azureResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureResourceId"u8)) + { + azureResourceId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SourceOrTarget(azureResourceId, 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(SourceOrTarget)} does not support writing '{options.Format}' format."); + } + } + + SourceOrTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSourceOrTarget(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SourceOrTarget)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.cs new file mode 100644 index 000000000000..f424234d0eee --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/SourceOrTarget.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Resource details. + internal partial class SourceOrTarget + { + /// + /// 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 SourceOrTarget() + { + } + + /// Initializes a new instance of . + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + /// Keeps track of any properties unknown to the library. + internal SourceOrTarget(string azureResourceId, IDictionary serializedAdditionalRawData) + { + AzureResourceId = azureResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string AzureResourceId { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Toolset.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Toolset.cs new file mode 100644 index 000000000000..18e2aa31bfd0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Toolset.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// List of azure interfaces. + public readonly partial struct Toolset : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Toolset(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TerraformValue = "Terraform"; + private const string PuppetValue = "Puppet"; + private const string ChefValue = "Chef"; + private const string SDKValue = "SDK"; + private const string AnsibleValue = "Ansible"; + private const string ARMValue = "ARM"; + private const string PortalValue = "Portal"; + private const string ShellValue = "Shell"; + private const string OtherValue = "Other"; + + /// If communication toolset is Terraform. + public static Toolset Terraform { get; } = new Toolset(TerraformValue); + /// If communication toolset is Puppet. + public static Toolset Puppet { get; } = new Toolset(PuppetValue); + /// If communication toolset is Chef. + public static Toolset Chef { get; } = new Toolset(ChefValue); + /// If communication toolset is SDK. + public static Toolset SDK { get; } = new Toolset(SDKValue); + /// If communication toolset is Ansible. + public static Toolset Ansible { get; } = new Toolset(AnsibleValue); + /// If communication toolset is ARM. + public static Toolset ARM { get; } = new Toolset(ARMValue); + /// If communication toolset is Portal. + public static Toolset Portal { get; } = new Toolset(PortalValue); + /// If communication toolset is Shell. + public static Toolset Shell { get; } = new Toolset(ShellValue); + /// If communication toolset is Other. + public static Toolset Other { get; } = new Toolset(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(Toolset left, Toolset right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Toolset left, Toolset right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Toolset(string value) => new Toolset(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Toolset other && Equals(other); + /// + public bool Equals(Toolset 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.Serialization.cs new file mode 100644 index 000000000000..6adc07789cb1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.Serialization.cs @@ -0,0 +1,144 @@ +// 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.ImpactReporting.Models +{ + public partial class Workload : 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(Workload)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Context)) + { + writer.WritePropertyName("context"u8); + writer.WriteStringValue(Context); + } + if (Optional.IsDefined(Toolset)) + { + writer.WritePropertyName("toolset"u8); + writer.WriteStringValue(Toolset.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Workload 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(Workload)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkload(document.RootElement, options); + } + + internal static Workload DeserializeWorkload(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string context = default; + Toolset? toolset = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("toolset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + toolset = new Toolset(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Workload(context, toolset, 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(Workload)} does not support writing '{options.Format}' format."); + } + } + + Workload IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkload(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Workload)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.cs new file mode 100644 index 000000000000..ca0edd5f8cdb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/Workload.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Information about the impacted workload. + public partial class Workload + { + /// + /// 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 Workload() + { + } + + /// Initializes a new instance of . + /// the scenario for the workload. + /// Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + /// Keeps track of any properties unknown to the library. + internal Workload(string context, Toolset? toolset, IDictionary serializedAdditionalRawData) + { + Context = context; + Toolset = toolset; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// the scenario for the workload. + public string Context { get; set; } + /// Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + public Toolset? Toolset { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.Serialization.cs new file mode 100644 index 000000000000..c1edd070e188 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.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.ImpactReporting.Models +{ + internal partial class WorkloadImpactListResult : 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(WorkloadImpactListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactListResult 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(WorkloadImpactListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactListResult(document.RootElement, options); + } + + internal static WorkloadImpactListResult DeserializeWorkloadImpactListResult(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(WorkloadImpactData.DeserializeWorkloadImpactData(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 WorkloadImpactListResult(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(WorkloadImpactListResult)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.cs new file mode 100644 index 000000000000..91a0bf749286 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactListResult.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.ImpactReporting.Models +{ + /// The response of a WorkloadImpact list operation. + internal partial class WorkloadImpactListResult + { + /// + /// 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 WorkloadImpact items on this page. + /// is null. + internal WorkloadImpactListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The WorkloadImpact items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkloadImpactListResult() + { + } + + /// The WorkloadImpact items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.Serialization.cs new file mode 100644 index 000000000000..82b1c5235e8f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.Serialization.cs @@ -0,0 +1,378 @@ +// 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.ImpactReporting.Models +{ + public partial class WorkloadImpactProperties : 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(WorkloadImpactProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn, "O"); + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + writer.WritePropertyName("impactedResourceId"u8); + writer.WriteStringValue(ImpactedResourceId); + if (options.Format != "W" && Optional.IsDefined(ImpactUniqueId)) + { + writer.WritePropertyName("impactUniqueId"u8); + writer.WriteStringValue(ImpactUniqueId); + } + if (options.Format != "W" && Optional.IsDefined(ReportedTimeUtc)) + { + writer.WritePropertyName("reportedTimeUtc"u8); + writer.WriteStringValue(ReportedTimeUtc.Value, "O"); + } + writer.WritePropertyName("impactCategory"u8); + writer.WriteStringValue(ImpactCategory); + if (Optional.IsDefined(ImpactDescription)) + { + writer.WritePropertyName("impactDescription"u8); + writer.WriteStringValue(ImpactDescription); + } + if (Optional.IsCollectionDefined(ArmCorrelationIds)) + { + writer.WritePropertyName("armCorrelationIds"u8); + writer.WriteStartArray(); + foreach (var item in ArmCorrelationIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Performance)) + { + writer.WritePropertyName("performance"u8); + writer.WriteStartArray(); + foreach (var item in Performance) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Connectivity)) + { + writer.WritePropertyName("connectivity"u8); + writer.WriteObjectValue(Connectivity, options); + } + if (Optional.IsDefined(AdditionalProperties)) + { + writer.WritePropertyName("additionalProperties"u8); + writer.WriteObjectValue(AdditionalProperties, options); + } + if (Optional.IsDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + writer.WriteObjectValue(ErrorDetails, options); + } + if (Optional.IsDefined(Workload)) + { + writer.WritePropertyName("workload"u8); + writer.WriteObjectValue(Workload, options); + } + if (Optional.IsDefined(ImpactGroupId)) + { + writer.WritePropertyName("impactGroupId"u8); + writer.WriteStringValue(ImpactGroupId); + } + if (Optional.IsDefined(ConfidenceLevel)) + { + writer.WritePropertyName("confidenceLevel"u8); + writer.WriteStringValue(ConfidenceLevel.Value.ToString()); + } + if (Optional.IsDefined(ClientIncidentDetails)) + { + writer.WritePropertyName("clientIncidentDetails"u8); + writer.WriteObjectValue(ClientIncidentDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactProperties 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(WorkloadImpactProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactProperties(document.RootElement, options); + } + + internal static WorkloadImpactProperties DeserializeWorkloadImpactProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + DateTimeOffset startDateTime = default; + DateTimeOffset? endDateTime = default; + string impactedResourceId = default; + string impactUniqueId = default; + DateTimeOffset? reportedTimeUtc = default; + string impactCategory = default; + string impactDescription = default; + IList armCorrelationIds = default; + IList performance = default; + Connectivity connectivity = default; + WorkloadImpactPropertiesAdditionalProperties additionalProperties = default; + ErrorDetailProperties errorDetails = default; + Workload workload = default; + string impactGroupId = default; + ConfidenceLevel? confidenceLevel = default; + ClientIncidentDetails clientIncidentDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("startDateTime"u8)) + { + startDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactedResourceId"u8)) + { + impactedResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("impactUniqueId"u8)) + { + impactUniqueId = property.Value.GetString(); + continue; + } + if (property.NameEquals("reportedTimeUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reportedTimeUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactCategory"u8)) + { + impactCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("impactDescription"u8)) + { + impactDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("armCorrelationIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + armCorrelationIds = array; + continue; + } + if (property.NameEquals("performance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.Performance.DeserializePerformance(item, options)); + } + performance = array; + continue; + } + if (property.NameEquals("connectivity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectivity = Connectivity.DeserializeConnectivity(property.Value, options); + continue; + } + if (property.NameEquals("additionalProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalProperties = WorkloadImpactPropertiesAdditionalProperties.DeserializeWorkloadImpactPropertiesAdditionalProperties(property.Value, options); + continue; + } + if (property.NameEquals("errorDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorDetails = ErrorDetailProperties.DeserializeErrorDetailProperties(property.Value, options); + continue; + } + if (property.NameEquals("workload"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workload = Workload.DeserializeWorkload(property.Value, options); + continue; + } + if (property.NameEquals("impactGroupId"u8)) + { + impactGroupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceLevel = new ConfidenceLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientIncidentDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientIncidentDetails = ClientIncidentDetails.DeserializeClientIncidentDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactProperties( + provisioningState, + startDateTime, + endDateTime, + impactedResourceId, + impactUniqueId, + reportedTimeUtc, + impactCategory, + impactDescription, + armCorrelationIds ?? new ChangeTrackingList(), + performance ?? new ChangeTrackingList(), + connectivity, + additionalProperties, + errorDetails, + workload, + impactGroupId, + confidenceLevel, + clientIncidentDetails, + 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(WorkloadImpactProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.cs new file mode 100644 index 000000000000..b4745430bff7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactProperties.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// Workload impact properties. + public partial class WorkloadImpactProperties + { + /// + /// 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 . + /// Time at which impact was observed. + /// Azure resource id of the impacted resource. + /// Category of the impact, details can found from /impactCategories API. + /// or is null. + public WorkloadImpactProperties(DateTimeOffset startOn, string impactedResourceId, string impactCategory) + { + Argument.AssertNotNull(impactedResourceId, nameof(impactedResourceId)); + Argument.AssertNotNull(impactCategory, nameof(impactCategory)); + + StartOn = startOn; + ImpactedResourceId = impactedResourceId; + ImpactCategory = impactCategory; + ArmCorrelationIds = new ChangeTrackingList(); + Performance = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Time at which impact was observed. + /// Time at which impact has ended. + /// Azure resource id of the impacted resource. + /// Unique ID of the impact (UUID). + /// Time at which impact is reported. + /// Category of the impact, details can found from /impactCategories API. + /// A detailed description of the impact. + /// The ARM correlation ids, this is important field for control plane related impacts. + /// Details about performance issue. Applicable for performance impacts. + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + /// ARM error code and error message associated with the impact. + /// Information about the impacted workload. + /// Use this field to group impacts. + /// Degree of confidence on the impact being a platform issue. + /// Client incident details ex: incidentId , incident source. + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactProperties(ProvisioningState? provisioningState, DateTimeOffset startOn, DateTimeOffset? endOn, string impactedResourceId, string impactUniqueId, DateTimeOffset? reportedTimeUtc, string impactCategory, string impactDescription, IList armCorrelationIds, IList performance, Connectivity connectivity, WorkloadImpactPropertiesAdditionalProperties additionalProperties, ErrorDetailProperties errorDetails, Workload workload, string impactGroupId, ConfidenceLevel? confidenceLevel, ClientIncidentDetails clientIncidentDetails, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + StartOn = startOn; + EndOn = endOn; + ImpactedResourceId = impactedResourceId; + ImpactUniqueId = impactUniqueId; + ReportedTimeUtc = reportedTimeUtc; + ImpactCategory = impactCategory; + ImpactDescription = impactDescription; + ArmCorrelationIds = armCorrelationIds; + Performance = performance; + Connectivity = connectivity; + AdditionalProperties = additionalProperties; + ErrorDetails = errorDetails; + Workload = workload; + ImpactGroupId = impactGroupId; + ConfidenceLevel = confidenceLevel; + ClientIncidentDetails = clientIncidentDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkloadImpactProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// Time at which impact was observed. + public DateTimeOffset StartOn { get; set; } + /// Time at which impact has ended. + public DateTimeOffset? EndOn { get; set; } + /// Azure resource id of the impacted resource. + public string ImpactedResourceId { get; set; } + /// Unique ID of the impact (UUID). + public string ImpactUniqueId { get; } + /// Time at which impact is reported. + public DateTimeOffset? ReportedTimeUtc { get; } + /// Category of the impact, details can found from /impactCategories API. + public string ImpactCategory { get; set; } + /// A detailed description of the impact. + public string ImpactDescription { get; set; } + /// The ARM correlation ids, this is important field for control plane related impacts. + public IList ArmCorrelationIds { get; } + /// Details about performance issue. Applicable for performance impacts. + public IList Performance { get; } + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + public Connectivity Connectivity { get; set; } + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + public WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get; set; } + /// ARM error code and error message associated with the impact. + public ErrorDetailProperties ErrorDetails { get; set; } + /// Information about the impacted workload. + public Workload Workload { get; set; } + /// Use this field to group impacts. + public string ImpactGroupId { get; set; } + /// Degree of confidence on the impact being a platform issue. + public ConfidenceLevel? ConfidenceLevel { get; set; } + /// Client incident details ex: incidentId , incident source. + public ClientIncidentDetails ClientIncidentDetails { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs new file mode 100644 index 000000000000..9f73b1d92d2d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs @@ -0,0 +1,118 @@ +// 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.ImpactReporting.Models +{ + public partial class WorkloadImpactPropertiesAdditionalProperties : 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(WorkloadImpactPropertiesAdditionalProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactPropertiesAdditionalProperties 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(WorkloadImpactPropertiesAdditionalProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactPropertiesAdditionalProperties(document.RootElement, options); + } + + internal static WorkloadImpactPropertiesAdditionalProperties DeserializeWorkloadImpactPropertiesAdditionalProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactPropertiesAdditionalProperties(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(WorkloadImpactPropertiesAdditionalProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactPropertiesAdditionalProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactPropertiesAdditionalProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactPropertiesAdditionalProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs new file mode 100644 index 000000000000..a46fed669515 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ImpactReporting.Models +{ + /// The WorkloadImpactPropertiesAdditionalProperties. + public partial class WorkloadImpactPropertiesAdditionalProperties + { + /// + /// 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 WorkloadImpactPropertiesAdditionalProperties() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactPropertiesAdditionalProperties(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ProviderConstants.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..71ee32aa17a0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ConnectorsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ConnectorsRestOperations.cs new file mode 100644 index 000000000000..a2683b73e1c4 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ConnectorsRestOperations.cs @@ -0,0 +1,533 @@ +// 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.ImpactReporting.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal partial class ConnectorsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConnectorsRestOperations. + /// 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 ConnectorsRestOperations(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 ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string connectorName) + { + 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.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string connectorName, ConnectorData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string connectorName, ConnectorData 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("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, 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 Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, connectorName, 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 Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, connectorName, 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 connectorName, ConnectorPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string connectorName, ConnectorPatch 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("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, 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 Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, ConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, connectorName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, ConnectorPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, connectorName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string connectorName) + { + 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("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, connectorName); + 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 Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return 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.Impact/connectors", 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.Impact/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Connector 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: + { + ConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Connector 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: + { + ConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorListResult.DeserializeConnectorListResult(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 Connector 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: + { + ConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Connector 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: + { + ConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs new file mode 100644 index 000000000000..e62fbbd62503 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs @@ -0,0 +1,303 @@ +// 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.ImpactReporting.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal partial class ImpactCategoriesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ImpactCategoriesRestOperations. + /// 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 ImpactCategoriesRestOperations(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 ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string impactCategoryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/impactCategories/", false); + uri.AppendPath(impactCategoryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string impactCategoryName) + { + 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.Impact/impactCategories/", false); + uri.AppendPath(impactCategoryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a ImpactCategory. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the impact category. + /// 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 impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var message = CreateGetRequest(subscriptionId, impactCategoryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryData.DeserializeImpactCategoryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ImpactCategoryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a ImpactCategory. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the impact category. + /// 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 impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var message = CreateGetRequest(subscriptionId, impactCategoryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryData.DeserializeImpactCategoryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ImpactCategoryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string resourceType, string categoryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/impactCategories", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (categoryName != null) + { + uri.AppendQuery("categoryName", categoryName, true); + } + uri.AppendQuery("resourceType", resourceType, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string resourceType, string categoryName) + { + 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.Impact/impactCategories", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (categoryName != null) + { + uri.AppendQuery("categoryName", categoryName, true); + } + uri.AppendQuery("resourceType", resourceType, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ImpactCategory resources by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by resource type. + /// Filter by category name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, resourceType, categoryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ImpactCategory resources by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by resource type. + /// Filter by category name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, resourceType, categoryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string resourceType, string categoryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string resourceType, string categoryName) + { + 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 ImpactCategory resources by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by resource type. + /// Filter by category name. + /// 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, string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, resourceType, categoryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ImpactCategory resources by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by resource type. + /// Filter by category name. + /// 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, string resourceType, string categoryName = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNull(resourceType, nameof(resourceType)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, resourceType, categoryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/InsightsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/InsightsRestOperations.cs new file mode 100644 index 000000000000..00c9f56542d9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/InsightsRestOperations.cs @@ -0,0 +1,487 @@ +// 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.ImpactReporting.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal partial class InsightsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InsightsRestOperations. + /// 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 InsightsRestOperations(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 ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string workloadImpactName, string insightName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string workloadImpactName, string insightName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get Insight resources by workloadImpactName and insightName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName, insightName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InsightData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get Insight resources by workloadImpactName and insightName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName, insightName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InsightData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string workloadImpactName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Insight resources by workloadImpactName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Insight resources by workloadImpactName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string workloadImpactName, string insightName, InsightData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string workloadImpactName, string insightName, InsightData 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, 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 Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, insightName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + InsightData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, insightName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + InsightData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string workloadImpactName, string insightName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string workloadImpactName, string insightName) + { + 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName, insightName); + 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 Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName, insightName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string workloadImpactName) + { + 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 Insight resources by workloadImpactName. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Insight resources by workloadImpactName. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs new file mode 100644 index 000000000000..2f1514c4e867 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs @@ -0,0 +1,441 @@ +// 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.ImpactReporting.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + internal partial class WorkloadImpactsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadImpactsRestOperations. + /// 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 WorkloadImpactsRestOperations(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 ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string workloadImpactName, WorkloadImpactData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string workloadImpactName, WorkloadImpactData 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, 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 WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// 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 workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, 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 WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// 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 workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string workloadImpactName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadImpactData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadImpactData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string workloadImpactName) + { + 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName); + 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 WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return 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.Impact/workloadImpacts", 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.Impact/workloadImpacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadImpact 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: + { + WorkloadImpactListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadImpact 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: + { + WorkloadImpactListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(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 WorkloadImpact 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: + { + WorkloadImpactListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadImpact 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: + { + WorkloadImpactListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactCollection.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactCollection.cs new file mode 100644 index 000000000000..a3990e046fb9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactCollection.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.ImpactReporting +{ + /// + /// 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 GetWorkloadImpacts method from an instance of . + /// + public partial class WorkloadImpactCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _workloadImpactClientDiagnostics; + private readonly WorkloadImpactsRestOperations _workloadImpactRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadImpactCollection() + { + } + + /// 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 WorkloadImpactCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workloadImpactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", WorkloadImpactResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkloadImpactResource.ResourceType, out string workloadImpactApiVersion); + _workloadImpactRestClient = new WorkloadImpactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadImpactApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// workloadImpact resource. + /// 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 workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.CreateAsync(Id.SubscriptionId, workloadImpactName, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactReportingArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, workloadImpactName, 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 WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// workloadImpact resource. + /// 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 workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Create(Id.SubscriptionId, workloadImpactName, data, cancellationToken); + var operation = new ImpactReportingArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, workloadImpactName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Get"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Get"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadImpact resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts + /// + /// + /// Operation Id + /// WorkloadImpact_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadImpactRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadImpactRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadImpactResource(Client, WorkloadImpactData.DeserializeWorkloadImpactData(e)), _workloadImpactClientDiagnostics, Pipeline, "WorkloadImpactCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadImpact resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts + /// + /// + /// Operation Id + /// WorkloadImpact_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadImpactRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadImpactRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadImpactResource(Client, WorkloadImpactData.DeserializeWorkloadImpactData(e)), _workloadImpactClientDiagnostics, Pipeline, "WorkloadImpactCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Exists"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Exists"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.Serialization.cs new file mode 100644 index 000000000000..c8d6cb75b77d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + public partial class WorkloadImpactData : 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(WorkloadImpactData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadImpactData 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(WorkloadImpactData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactData(document.RootElement, options); + } + + internal static WorkloadImpactData DeserializeWorkloadImpactData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadImpactProperties 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 = WorkloadImpactProperties.DeserializeWorkloadImpactProperties(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 WorkloadImpactData( + 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(WorkloadImpactData)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.cs new file mode 100644 index 000000000000..88aee464ed2d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactData.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.ImpactReporting.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A class representing the WorkloadImpact data model. + /// Workload Impact properties + /// + public partial class WorkloadImpactData : 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 WorkloadImpactData() + { + } + + /// 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 WorkloadImpactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadImpactProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadImpactProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.Serialization.cs new file mode 100644 index 000000000000..0fede991d873 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.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.ImpactReporting +{ + public partial class WorkloadImpactResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + WorkloadImpactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + WorkloadImpactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.cs new file mode 100644 index 000000000000..ed77e2ebe516 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Generated/WorkloadImpactResource.cs @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ImpactReporting +{ + /// + /// A Class representing a WorkloadImpact 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 GetWorkloadImpactResource method. + /// Otherwise you can get one from its parent resource using the GetWorkloadImpact method. + /// + public partial class WorkloadImpactResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The workloadImpactName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _workloadImpactClientDiagnostics; + private readonly WorkloadImpactsRestOperations _workloadImpactRestClient; + private readonly WorkloadImpactData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/workloadImpacts"; + + /// Initializes a new instance of the class for mocking. + protected WorkloadImpactResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadImpactResource(ArmClient client, WorkloadImpactData 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 WorkloadImpactResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workloadImpactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ImpactReporting", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workloadImpactApiVersion); + _workloadImpactRestClient = new WorkloadImpactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadImpactApiVersion); +#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 WorkloadImpactData 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 InsightResources in the WorkloadImpact. + /// An object representing collection of InsightResources and their operations over a InsightResource. + public virtual InsightCollection GetInsights() + { + return GetCachedClient(client => new InsightCollection(client, Id)); + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInsightAsync(string insightName, CancellationToken cancellationToken = default) + { + return await GetInsights().GetAsync(insightName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInsight(string insightName, CancellationToken cancellationToken = default) + { + return GetInsights().Get(insightName, cancellationToken); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Get"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Get"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Delete"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _workloadImpactRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Delete"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var uri = _workloadImpactRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactReportingArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Update"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.CreateAsync(Id.SubscriptionId, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactReportingArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, 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 WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Update"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Create(Id.SubscriptionId, Id.Name, data, cancellationToken); + var operation = new ImpactReportingArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, 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/impactreporting/Azure.ResourceManager.ImpactReporting/src/Properties/AssemblyInfo.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..e5dd7e731e1b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/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.ImpactReporting.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("ImpactReporting")] diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/Azure.ResourceManager.ImpactReporting.Tests.csproj b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/Azure.ResourceManager.ImpactReporting.Tests.csproj new file mode 100644 index 000000000000..bb52a13a69e6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/Azure.ResourceManager.ImpactReporting.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestBase.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestBase.cs new file mode 100644 index 000000000000..5c2bc05c5d1a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestBase.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.ImpactReporting.Tests +{ + public class ImpactReportingManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected ImpactReportingManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ImpactReportingManagementTestBase(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/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestEnvironment.cs b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestEnvironment.cs new file mode 100644 index 000000000000..ac5b6e7c9f9b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tests/ImpactReportingManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.ImpactReporting.Tests +{ + public class ImpactReportingManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tsp-location.yaml b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tsp-location.yaml new file mode 100644 index 000000000000..aba7d1031f11 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.ImpactReporting/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/impact/Impact.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/impactreporting/ci.mgmt.yml b/sdk/impactreporting/ci.mgmt.yml new file mode 100644 index 000000000000..f476798de69a --- /dev/null +++ b/sdk/impactreporting/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/impactreporting /ci.mgmt.yml + - sdk/impactreporting /Azure.ResourceManager.ImpactReporting / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: impactreporting + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.ImpactReporting + safeName: AzureResourceManagerImpactReporting diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs index be41ef5b289c..61a91910b891 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.net8.0.cs @@ -215,12 +215,30 @@ public static partial class ArmMongoClusterModelFactory public static Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResourceData MongoClusterPrivateEndpointConnectionResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceData MongoClusterPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties MongoClusterPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } - public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, Azure.ResourceManager.MongoCluster.Models.DataApiMode? dataApiMode = default(Azure.ResourceManager.MongoCluster.Models.DataApiMode?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplica MongoClusterReplica(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties MongoClusterReplicationProperties(Azure.Core.ResourceIdentifier sourceResourceId = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole? role = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole?), Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState? replicationState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState?)) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent PromoteReplicaContent(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption promoteOption = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption), Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode? mode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataApiMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataApiMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Disabled { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.DataApiMode 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.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.DataApiMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct HighAvailabilityMode : System.IEquatable { private readonly object _dummy; @@ -524,6 +542,7 @@ public MongoClusterProperties() { } public string ComputeTier { get { throw null; } set { } } public string ConnectionString { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public string InfrastructureVersion { get { throw null; } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } @@ -701,6 +720,7 @@ public MongoClusterUpdateProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } public string BackupEarliestRestoreTime { get { throw null; } } public string ComputeTier { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs index be41ef5b289c..61a91910b891 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/api/Azure.ResourceManager.MongoCluster.netstandard2.0.cs @@ -215,12 +215,30 @@ public static partial class ArmMongoClusterModelFactory public static Azure.ResourceManager.MongoCluster.MongoClusterPrivateEndpointConnectionResourceData MongoClusterPrivateEndpointConnectionResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateEndpointConnectionProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceData MongoClusterPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterPrivateLinkResourceProperties MongoClusterPrivateLinkResourceProperties(string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } - public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties MongoClusterProperties(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? createMode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode?), Azure.ResourceManager.MongoCluster.Models.MongoClusterRestoreContent restoreParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicaContent replicaParameters = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState? provisioningState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterProvisioningState?), Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus? clusterStatus = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterStatus?), Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess?), Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? highAvailabilityTargetMode = default(Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode?), long? storageSizeGb = default(long?), int? shardingShardCount = default(int?), string computeTier = null, string backupEarliestRestoreTime = null, Azure.ResourceManager.MongoCluster.Models.DataApiMode? dataApiMode = default(Azure.ResourceManager.MongoCluster.Models.DataApiMode?), System.Collections.Generic.IEnumerable privateEndpointConnections = null, System.Collections.Generic.IEnumerable previewFeatures = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplica MongoClusterReplica(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterProperties properties = null) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationProperties MongoClusterReplicationProperties(Azure.Core.ResourceIdentifier sourceResourceId = null, Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole? role = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationRole?), Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState? replicationState = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterReplicationState?)) { throw null; } public static Azure.ResourceManager.MongoCluster.Models.PromoteReplicaContent PromoteReplicaContent(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption promoteOption = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteOption), Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode? mode = default(Azure.ResourceManager.MongoCluster.Models.MongoClusterPromoteMode?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DataApiMode : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DataApiMode(string value) { throw null; } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Disabled { get { throw null; } } + public static Azure.ResourceManager.MongoCluster.Models.DataApiMode Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.MongoCluster.Models.DataApiMode 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.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public static implicit operator Azure.ResourceManager.MongoCluster.Models.DataApiMode (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.MongoCluster.Models.DataApiMode left, Azure.ResourceManager.MongoCluster.Models.DataApiMode right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct HighAvailabilityMode : System.IEquatable { private readonly object _dummy; @@ -524,6 +542,7 @@ public MongoClusterProperties() { } public string ComputeTier { get { throw null; } set { } } public string ConnectionString { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterCreateMode? CreateMode { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public string InfrastructureVersion { get { throw null; } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } @@ -701,6 +720,7 @@ public MongoClusterUpdateProperties() { } public Azure.ResourceManager.MongoCluster.Models.MongoClusterAdministratorProperties Administrator { get { throw null; } set { } } public string BackupEarliestRestoreTime { get { throw null; } } public string ComputeTier { get { throw null; } set { } } + public Azure.ResourceManager.MongoCluster.Models.DataApiMode? DataApiMode { get { throw null; } set { } } public Azure.ResourceManager.MongoCluster.Models.HighAvailabilityMode? HighAvailabilityTargetMode { get { throw null; } set { } } public System.Collections.Generic.IList PreviewFeatures { get { throw null; } } public Azure.ResourceManager.MongoCluster.Models.MongoClusterPublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs index 3a1dea587e91..ec076fb08bcb 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_MongoClusterCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesANewMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Create.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Create.json // this example is just showing the usage of "MongoCluster_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 @@ -71,7 +71,7 @@ public async Task CreateOrUpdate_CreatesANewMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAReplicaMongoClusterResourceFromASourceResource() { - // Generated from example definition: 2024-07-01/MongoClusters_CreateGeoReplica.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_CreateGeoReplica.json // this example is just showing the usage of "MongoCluster_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 @@ -113,7 +113,7 @@ public async Task CreateOrUpdate_CreatesAReplicaMongoClusterResourceFromASourceR [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAMongoClusterResourceFromAPointInTimeRestore() { - // Generated from example definition: 2024-07-01/MongoClusters_CreatePITR.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_CreatePITR.json // this example is just showing the usage of "MongoCluster_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 @@ -159,7 +159,7 @@ public async Task CreateOrUpdate_CreatesAMongoClusterResourceFromAPointInTimeRes [Ignore("Only validating compilation of examples")] public async Task Get_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_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 @@ -192,7 +192,7 @@ public async Task Get_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsTheMongoClusterResourcesInAResourceGroup() { - // Generated from example definition: 2024-07-01/MongoClusters_ListByResourceGroup.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_ListByResourceGroup.json // this example is just showing the usage of "MongoCluster_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 @@ -227,7 +227,7 @@ public async Task GetAll_ListsTheMongoClusterResourcesInAResourceGroup() [Ignore("Only validating compilation of examples")] public async Task Exists_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_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 @@ -256,7 +256,7 @@ public async Task Exists_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs index f95bd4dccd14..1fd66ec01117 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterFirewallRuleCollection [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_CreatesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleCreate.json // this example is just showing the usage of "FirewallRule_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -59,7 +59,7 @@ public async Task CreateOrUpdate_CreatesAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_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 @@ -93,7 +93,7 @@ public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListTheFirewallRulesOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleList.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleList.json // this example is just showing the usage of "FirewallRule_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task GetAll_ListTheFirewallRulesOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Exists_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_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 @@ -159,7 +159,7 @@ public async Task Exists_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs index d4aa354b7aaf..c56bc9192467 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterFirewallRuleResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterFirewallRuleResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleGet.json // this example is just showing the usage of "FirewallRule_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetsAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleDelete.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleDelete.json // this example is just showing the usage of "FirewallRule_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeletesAFirewallRuleOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Update_CreatesAFirewallRuleOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_FirewallRuleCreate.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_FirewallRuleCreate.json // this example is just showing the usage of "FirewallRule_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs index b613f615940e..5c8ec07c0c79 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterPrivateEndpointConnectionResource [Ignore("Only validating compilation of examples")] public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeleteAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionDelete.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionDelete.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -78,7 +78,7 @@ public async Task Delete_DeleteAPrivateEndpointConnectionOnAMongoClusterResource [Ignore("Only validating compilation of examples")] public async Task Update_ApprovesAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionPut.json // this example is just showing the usage of "PrivateEndpointConnectionResource_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 diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs index f0480e5f2648..4b57ad591764 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterPrivateEndpointConnectionResourceCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterPrivateEndpointConnectionResourceCollect [Ignore("Only validating compilation of examples")] public async Task CreateOrUpdate_ApprovesAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionPut.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionPut.json // this example is just showing the usage of "PrivateEndpointConnectionResource_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 @@ -63,7 +63,7 @@ public async Task CreateOrUpdate_ApprovesAPrivateEndpointConnectionOnAMongoClust [Ignore("Only validating compilation of examples")] public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_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 @@ -97,7 +97,7 @@ public async Task Get_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetAll_ListsThePrivateEndpointConnectionResourcesOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionList.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionList.json // this example is just showing the usage of "PrivateEndpointConnectionResource_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -133,7 +133,7 @@ public async Task GetAll_ListsThePrivateEndpointConnectionResourcesOnAMongoClust [Ignore("Only validating compilation of examples")] public async Task Exists_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_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 @@ -163,7 +163,7 @@ public async Task Exists_GetAPrivateEndpointConnectionOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetIfExists_GetAPrivateEndpointConnectionOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateEndpointConnectionGet.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateEndpointConnectionGet.json // this example is just showing the usage of "PrivateEndpointConnectionResource_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs index 89dc0e9ea8fe..a256b8b856f5 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_MongoClusterResource.cs @@ -20,7 +20,7 @@ public partial class Sample_MongoClusterResource [Ignore("Only validating compilation of examples")] public async Task Get_GetsAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Get.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Get.json // this example is just showing the usage of "MongoCluster_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetsAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Delete_DeletesAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Delete.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Delete.json // this example is just showing the usage of "MongoCluster_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 @@ -72,11 +72,49 @@ public async Task Delete_DeletesAMongoClusterResource() Console.WriteLine("Succeeded"); } + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_EnablesDataAPIOnAMongoClusterResource() + { + // Generated from example definition: 2024-10-01-preview/MongoClusters_PatchDataApi.json + // this example is just showing the usage of "MongoCluster_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 MongoClusterResource created on azure + // for more information of creating MongoClusterResource, please refer to the document of MongoClusterResource + string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff"; + string resourceGroupName = "TestResourceGroup"; + string mongoClusterName = "myMongoCluster"; + ResourceIdentifier mongoClusterResourceId = MongoClusterResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, mongoClusterName); + MongoClusterResource mongoCluster = client.GetMongoClusterResource(mongoClusterResourceId); + + // invoke the operation + MongoClusterPatch patch = new MongoClusterPatch + { + Properties = new MongoClusterUpdateProperties + { + DataApiMode = DataApiMode.Enabled, + }, + }; + ArmOperation lro = await mongoCluster.UpdateAsync(WaitUntil.Completed, patch); + MongoClusterResource 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 + MongoClusterData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + [Test] [Ignore("Only validating compilation of examples")] public async Task Update_UpdatesTheDiskSizeOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PatchDiskSize.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PatchDiskSize.json // this example is just showing the usage of "MongoCluster_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 @@ -114,7 +152,7 @@ public async Task Update_UpdatesTheDiskSizeOnAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task Update_DisablesPublicNetworkAccessOnAMongoClusterResourceWithAPrivateEndpointConnection() { - // Generated from example definition: 2024-07-01/MongoClusters_PatchPrivateNetworkAccess.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PatchPrivateNetworkAccess.json // this example is just showing the usage of "MongoCluster_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 @@ -152,7 +190,7 @@ public async Task Update_DisablesPublicNetworkAccessOnAMongoClusterResourceWithA [Ignore("Only validating compilation of examples")] public async Task Update_ResetsTheAdministratorLoginPassword() { - // Generated from example definition: 2024-07-01/MongoClusters_ResetPassword.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_ResetPassword.json // this example is just showing the usage of "MongoCluster_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 @@ -194,7 +232,7 @@ public async Task Update_ResetsTheAdministratorLoginPassword() [Ignore("Only validating compilation of examples")] public async Task Update_UpdatesAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_Update.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_Update.json // this example is just showing the usage of "MongoCluster_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 @@ -242,7 +280,7 @@ public async Task Update_UpdatesAMongoClusterResource() [Ignore("Only validating compilation of examples")] public async Task GetConnectionStrings_ListTheAvailableConnectionStringsForTheMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_ListConnectionStrings.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_ListConnectionStrings.json // this example is just showing the usage of "MongoClusters_ListConnectionStrings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -268,7 +306,7 @@ public async Task GetConnectionStrings_ListTheAvailableConnectionStringsForTheMo [Ignore("Only validating compilation of examples")] public async Task Promote_PromotesAReplicaMongoClusterResourceToAPrimaryRole() { - // Generated from example definition: 2024-07-01/MongoClusters_ForcePromoteReplica.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_ForcePromoteReplica.json // this example is just showing the usage of "MongoClusters_Promote" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -298,7 +336,7 @@ public async Task Promote_PromotesAReplicaMongoClusterResourceToAPrimaryRole() [Ignore("Only validating compilation of examples")] public async Task GetPrivateLinks_ListsThePrivateLinkResourcesAvailableOnAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_PrivateLinkResourceList.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_PrivateLinkResourceList.json // this example is just showing the usage of "PrivateLinkResource_ListByMongoCluster" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -327,7 +365,7 @@ public async Task GetPrivateLinks_ListsThePrivateLinkResourcesAvailableOnAMongoC [Ignore("Only validating compilation of examples")] public async Task GetReplicasByParent_ListTheReplicasLinkedToAMongoClusterResource() { - // Generated from example definition: 2024-07-01/MongoClusters_ReplicaList.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_ReplicaList.json // this example is just showing the usage of "Replica_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 diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 30d2c455dea6..b1a0920f2f00 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -21,7 +21,7 @@ public partial class Sample_SubscriptionResourceExtensions [Ignore("Only validating compilation of examples")] public async Task GetMongoClusters_ListsTheMongoClusterResourcesInASubscription() { - // Generated from example definition: 2024-07-01/MongoClusters_List.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_List.json // this example is just showing the usage of "MongoCluster_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task GetMongoClusters_ListsTheMongoClusterResourcesInASubscription( [Ignore("Only validating compilation of examples")] public async Task CheckMongoClusterNameAvailability_ChecksAndConfirmsTheMongoClusterNameIsAvailabilityForUse() { - // Generated from example definition: 2024-07-01/MongoClusters_NameAvailability.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_NameAvailability.json // this example is just showing the usage of "MongoClusters_CheckMongoClusterNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task CheckMongoClusterNameAvailability_ChecksAndConfirmsTheMongoClu [Ignore("Only validating compilation of examples")] public async Task CheckMongoClusterNameAvailability_ChecksAndReturnsThatTheMongoClusterNameIsAlreadyInUse() { - // Generated from example definition: 2024-07-01/MongoClusters_NameAvailability_AlreadyExists.json + // Generated from example definition: 2024-10-01-preview/MongoClusters_NameAvailability_AlreadyExists.json // this example is just showing the usage of "MongoClusters_CheckMongoClusterNameAvailability" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs index c34be115aacd..efe73ca88d92 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/ArmMongoClusterModelFactory.cs @@ -49,12 +49,13 @@ public static MongoClusterReplica MongoClusterReplica(ResourceIdentifier id = nu /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. /// List of private endpoint connections. /// The replication properties for the mongo cluster. /// The infrastructure version the cluster is provisioned on. /// A new instance for mocking. - public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMode? createMode = null, MongoClusterRestoreContent restoreParameters = null, MongoClusterReplicaContent replicaParameters = null, MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, MongoClusterProvisioningState? provisioningState = null, MongoClusterStatus? clusterStatus = null, MongoClusterPublicNetworkAccess? publicNetworkAccess = null, HighAvailabilityMode? highAvailabilityTargetMode = null, long? storageSizeGb = null, int? shardingShardCount = null, string computeTier = null, string backupEarliestRestoreTime = null, IEnumerable privateEndpointConnections = null, IEnumerable previewFeatures = null, MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) + public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMode? createMode = null, MongoClusterRestoreContent restoreParameters = null, MongoClusterReplicaContent replicaParameters = null, MongoClusterAdministratorProperties administrator = null, string serverVersion = null, string connectionString = null, MongoClusterProvisioningState? provisioningState = null, MongoClusterStatus? clusterStatus = null, MongoClusterPublicNetworkAccess? publicNetworkAccess = null, HighAvailabilityMode? highAvailabilityTargetMode = null, long? storageSizeGb = null, int? shardingShardCount = null, string computeTier = null, string backupEarliestRestoreTime = null, DataApiMode? dataApiMode = null, IEnumerable privateEndpointConnections = null, IEnumerable previewFeatures = null, MongoClusterReplicationProperties replica = null, string infrastructureVersion = null) { privateEndpointConnections ??= new List(); previewFeatures ??= new List(); @@ -74,6 +75,7 @@ public static MongoClusterProperties MongoClusterProperties(MongoClusterCreateMo shardingShardCount != null ? new ShardingProperties(shardingShardCount, serializedAdditionalRawData: null) : null, computeTier != null ? new ComputeProperties(computeTier, serializedAdditionalRawData: null) : null, backupEarliestRestoreTime != null ? new BackupProperties(backupEarliestRestoreTime, serializedAdditionalRawData: null) : null, + dataApiMode != null ? new DataApiProperties(dataApiMode, serializedAdditionalRawData: null) : null, privateEndpointConnections?.ToList(), previewFeatures?.ToList(), replica, diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs index 87e8ad903dcb..44026ea2aba3 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterResourceGroupResource.cs @@ -53,7 +53,7 @@ public virtual MongoClusterCollection GetMongoClusters() /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -84,7 +84,7 @@ public virtual async Task> GetMongoClusterAsync(s /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs index bcba1d0d3f84..f39a86ce17b1 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MockableMongoClusterSubscriptionResource.cs @@ -55,7 +55,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -85,7 +85,7 @@ public virtual AsyncPageable GetMongoClustersAsync(Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -115,7 +115,7 @@ public virtual Pageable GetMongoClusters(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -158,7 +158,7 @@ public virtual async Task> CheckMon /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs index ee4d0e4ffd35..5553f5d5064c 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Extensions/MongoClusterExtensions.cs @@ -120,7 +120,7 @@ public static MongoClusterCollection GetMongoClusters(this ResourceGroupResource /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -158,7 +158,7 @@ public static async Task> GetMongoClusterAsync(th /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -196,7 +196,7 @@ public static Response GetMongoCluster(this ResourceGroupR /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -232,7 +232,7 @@ public static AsyncPageable GetMongoClustersAsync(this Sub /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -268,7 +268,7 @@ public static Pageable GetMongoClusters(this SubscriptionR /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -305,7 +305,7 @@ public static async Task> CheckMong /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.cs new file mode 100644 index 000000000000..72ce8ed51f95 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiMode.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.MongoCluster.Models +{ + /// The mode to apply to the Mongo Data API. + public readonly partial struct DataApiMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataApiMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Mongo Data API is enabled for the cluster. + public static DataApiMode Enabled { get; } = new DataApiMode(EnabledValue); + /// Mongo Data API is disabled for the cluster. + public static DataApiMode Disabled { get; } = new DataApiMode(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(DataApiMode left, DataApiMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataApiMode left, DataApiMode right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DataApiMode(string value) => new DataApiMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataApiMode other && Equals(other); + /// + public bool Equals(DataApiMode 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/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.Serialization.cs new file mode 100644 index 000000000000..08f5d06138fa --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.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.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + internal partial class DataApiProperties : 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(DataApiProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DataApiProperties 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(DataApiProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataApiProperties(document.RootElement, options); + } + + internal static DataApiProperties DeserializeDataApiProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DataApiMode? mode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = new DataApiMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataApiProperties(mode, 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(DataApiProperties)} does not support writing '{options.Format}' format."); + } + } + + DataApiProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDataApiProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataApiProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs new file mode 100644 index 000000000000..5eccac330a35 --- /dev/null +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/DataApiProperties.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.MongoCluster.Models +{ + /// Data API properties. + internal partial class DataApiProperties + { + /// + /// 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 DataApiProperties() + { + } + + /// Initializes a new instance of . + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + /// Keeps track of any properties unknown to the library. + internal DataApiProperties(DataApiMode? mode, IDictionary serializedAdditionalRawData) + { + Mode = mode; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? Mode { get; set; } + } +} diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs index c1ab76b6b8b5..3c57478a4386 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.Serialization.cs @@ -104,6 +104,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backup"u8); writer.WriteObjectValue(Backup, options); } + if (Optional.IsDefined(DataApi)) + { + writer.WritePropertyName("dataApi"u8); + writer.WriteObjectValue(DataApi, options); + } if (options.Format != "W" && Optional.IsCollectionDefined(PrivateEndpointConnections)) { writer.WritePropertyName("privateEndpointConnections"u8); @@ -185,6 +190,7 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle ShardingProperties sharding = default; ComputeProperties compute = default; BackupProperties backup = default; + DataApiProperties dataApi = default; IReadOnlyList privateEndpointConnections = default; IList previewFeatures = default; MongoClusterReplicationProperties replica = default; @@ -311,6 +317,15 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle backup = BackupProperties.DeserializeBackupProperties(property.Value, options); continue; } + if (property.NameEquals("dataApi"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataApi = DataApiProperties.DeserializeDataApiProperties(property.Value, options); + continue; + } if (property.NameEquals("privateEndpointConnections"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -374,6 +389,7 @@ internal static MongoClusterProperties DeserializeMongoClusterProperties(JsonEle sharding, compute, backup, + dataApi, privateEndpointConnections ?? new ChangeTrackingList(), previewFeatures ?? new ChangeTrackingList(), replica, diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs index 34981443c068..fbd8073d21cd 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterProperties.cs @@ -67,12 +67,13 @@ public MongoClusterProperties() /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. /// List of private endpoint connections. /// The replication properties for the mongo cluster. /// The infrastructure version the cluster is provisioned on. /// Keeps track of any properties unknown to the library. - internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoClusterRestoreContent restoreParameters, MongoClusterReplicaContent replicaParameters, MongoClusterAdministratorProperties administrator, string serverVersion, string connectionString, MongoClusterProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, IReadOnlyList privateEndpointConnections, IList previewFeatures, MongoClusterReplicationProperties replica, string infrastructureVersion, IDictionary serializedAdditionalRawData) + internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoClusterRestoreContent restoreParameters, MongoClusterReplicaContent replicaParameters, MongoClusterAdministratorProperties administrator, string serverVersion, string connectionString, MongoClusterProvisioningState? provisioningState, MongoClusterStatus? clusterStatus, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, DataApiProperties dataApi, IReadOnlyList privateEndpointConnections, IList previewFeatures, MongoClusterReplicationProperties replica, string infrastructureVersion, IDictionary serializedAdditionalRawData) { CreateMode = createMode; RestoreParameters = restoreParameters; @@ -88,6 +89,7 @@ internal MongoClusterProperties(MongoClusterCreateMode? createMode, MongoCluster Sharding = sharding; Compute = compute; Backup = backup; + DataApi = dataApi; PrivateEndpointConnections = privateEndpointConnections; PreviewFeatures = previewFeatures; Replica = replica; @@ -177,6 +179,20 @@ public string BackupEarliestRestoreTime get => Backup is null ? default : Backup.EarliestRestoreTime; } + /// The Data API properties of the mongo cluster. + internal DataApiProperties DataApi { get; set; } + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? DataApiMode + { + get => DataApi is null ? default : DataApi.Mode; + set + { + if (DataApi is null) + DataApi = new DataApiProperties(); + DataApi.Mode = value; + } + } + /// List of private endpoint connections. public IReadOnlyList PrivateEndpointConnections { get; } /// List of private endpoint connections. diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs index f2db8c5c6527..7a97b05f61b3 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.Serialization.cs @@ -74,6 +74,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("backup"u8); writer.WriteObjectValue(Backup, options); } + if (Optional.IsDefined(DataApi)) + { + writer.WritePropertyName("dataApi"u8); + writer.WriteObjectValue(DataApi, options); + } if (Optional.IsCollectionDefined(PreviewFeatures)) { writer.WritePropertyName("previewFeatures"u8); @@ -129,6 +134,7 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper ShardingProperties sharding = default; ComputeProperties compute = default; BackupProperties backup = default; + DataApiProperties dataApi = default; IList previewFeatures = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -202,6 +208,15 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper backup = BackupProperties.DeserializeBackupProperties(property.Value, options); continue; } + if (property.NameEquals("dataApi"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dataApi = DataApiProperties.DeserializeDataApiProperties(property.Value, options); + continue; + } if (property.NameEquals("previewFeatures"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -231,6 +246,7 @@ internal static MongoClusterUpdateProperties DeserializeMongoClusterUpdateProper sharding, compute, backup, + dataApi, previewFeatures ?? new ChangeTrackingList(), serializedAdditionalRawData); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs index 182cdb763b42..6a5064ab3b83 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/Models/MongoClusterUpdateProperties.cs @@ -60,9 +60,10 @@ public MongoClusterUpdateProperties() /// The sharding properties of the mongo cluster. /// The compute properties of the mongo cluster. /// The backup properties of the mongo cluster. + /// The Data API properties of the mongo cluster. /// List of private endpoint connections. /// Keeps track of any properties unknown to the library. - internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties administrator, string serverVersion, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, IList previewFeatures, IDictionary serializedAdditionalRawData) + internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties administrator, string serverVersion, MongoClusterPublicNetworkAccess? publicNetworkAccess, HighAvailabilityProperties highAvailability, StorageProperties storage, ShardingProperties sharding, ComputeProperties compute, BackupProperties backup, DataApiProperties dataApi, IList previewFeatures, IDictionary serializedAdditionalRawData) { Administrator = administrator; ServerVersion = serverVersion; @@ -72,6 +73,7 @@ internal MongoClusterUpdateProperties(MongoClusterAdministratorProperties admini Sharding = sharding; Compute = compute; Backup = backup; + DataApi = dataApi; PreviewFeatures = previewFeatures; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -146,6 +148,20 @@ public string BackupEarliestRestoreTime get => Backup is null ? default : Backup.EarliestRestoreTime; } + /// The Data API properties of the mongo cluster. + internal DataApiProperties DataApi { get; set; } + /// The mode to indicate whether the Mongo Data API is enabled for a cluster. + public DataApiMode? DataApiMode + { + get => DataApi is null ? default : DataApi.Mode; + set + { + if (DataApi is null) + DataApi = new DataApiProperties(); + DataApi.Mode = value; + } + } + /// List of private endpoint connections. public IList PreviewFeatures { get; } } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs index c8d9efdce71d..fa42720d1dca 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAsyn /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitU /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string mongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string mongoClusterName, Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancellat /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string mongoClusterName, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string mongoClusterName, CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExistsAsy /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs index 941f285a6a0f..339303e8b618 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Create /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(Wai /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsync(s /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string firewallRul /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string firewallRuleName, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string firewallRuleName, CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs index fd29a6f95f8d..54451a15a37b 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterFirewallRuleResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(C /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task> Update /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs index 07c1a1c07d42..03d574d3fe68 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -223,7 +223,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -265,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs index 8136ff74d1d0..d6f6245505b1 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterPrivateEndpointConnectionResourceCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation Creat /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(strin /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetA /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Ca /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs index 6804c462bb87..fe2df69ff779 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/MongoClusterResource.cs @@ -119,7 +119,7 @@ public virtual MongoClusterFirewallRuleCollection GetMongoClusterFirewallRules() /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -150,7 +150,7 @@ public virtual async Task> GetMongoCl /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -188,7 +188,7 @@ public virtual MongoClusterPrivateEndpointConnectionResourceCollection GetMongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -219,7 +219,7 @@ public virtual async Task /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -250,7 +250,7 @@ public virtual Response GetMongoC /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -290,7 +290,7 @@ public virtual async Task> GetAsync(CancellationT /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -330,7 +330,7 @@ public virtual Response Get(CancellationToken cancellation /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -372,7 +372,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -414,7 +414,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -460,7 +460,7 @@ public virtual async Task> UpdateAsync(WaitUn /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -506,7 +506,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Mo /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -544,7 +544,7 @@ public virtual async Task> GetConn /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -582,7 +582,7 @@ public virtual Response GetConnectionString /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -628,7 +628,7 @@ public virtual async Task PromoteAsync(WaitUntil waitUntil, Promot /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -674,7 +674,7 @@ public virtual ArmOperation Promote(WaitUntil waitUntil, PromoteReplicaContent c /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// @@ -700,7 +700,7 @@ public virtual AsyncPageable GetPrivateLink /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// @@ -726,7 +726,7 @@ public virtual Pageable GetPrivateLinks(Can /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// @@ -752,7 +752,7 @@ public virtual AsyncPageable GetReplicasByParentAsync(Cance /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// @@ -778,7 +778,7 @@ public virtual Pageable GetReplicasByParent(CancellationTok /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -840,7 +840,7 @@ public virtual async Task> AddTagAsync(string key /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -902,7 +902,7 @@ public virtual Response AddTag(string key, string value, C /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -959,7 +959,7 @@ public virtual async Task> SetTagsAsync(IDictiona /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -1016,7 +1016,7 @@ public virtual Response SetTags(IDictionary /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource @@ -1076,7 +1076,7 @@ public virtual async Task> RemoveTagAsync(string /// /// /// Default Api Version - /// 2024-07-01 + /// 2024-10-01-preview /// /// /// Resource diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs index bf20b85c4206..d62a5fdb604e 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/FirewallRulesRestOperations.cs @@ -32,7 +32,7 @@ public FirewallRulesRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2024-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs index db09b8aa6411..08bb3ce90162 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/MongoClustersRestOperations.cs @@ -32,7 +32,7 @@ public MongoClustersRestOperations(HttpPipeline pipeline, string applicationId, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2024-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs index f6170a8230f9..81273605b4eb 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -32,7 +32,7 @@ public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string ap { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2024-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs index 1f471b6e3234..1a274fc9a40b 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/PrivateLinksRestOperations.cs @@ -32,7 +32,7 @@ public PrivateLinksRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2024-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs index 79337d42e173..b6ebe380adfe 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/src/Generated/RestOperations/ReplicasRestOperations.cs @@ -32,7 +32,7 @@ public ReplicasRestOperations(HttpPipeline pipeline, string applicationId, Uri e { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-07-01"; + _apiVersion = apiVersion ?? "2024-10-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml index 95a1e28c447e..8d92a2278899 100644 --- a/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml +++ b/sdk/mongocluster/Azure.ResourceManager.MongoCluster/tsp-location.yaml @@ -1,3 +1,4 @@ -directory: specification\mongocluster\DocumentDB.MongoCluster.Management -commit: 9ce76c4f113368361dac4de5d0a71eb058602756 -repo: Azure/azure-rest-api-specs \ No newline at end of file +directory: specification/mongocluster/DocumentDB.MongoCluster.Management +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md b/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md index 3888e6e016b5..39e4cbfd91dc 100644 --- a/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md +++ b/sdk/monitor/Azure.ResourceManager.Monitor/src/autorest.md @@ -537,30 +537,30 @@ These settings apply only when `--tag=package-2024-10-01-preview` is specified o ```yaml $(tag) == 'package-2024-10-01-preview' title: MonitorManagementClient input-file: -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/autoscale_API.json -# - https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json # we do not need to support this -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRulesIncidents_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/2491b616cde43277fae339604f03f59412e016aa/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRules_API.json # we should not change this commit because APIs in this file has been deprecated and removed in https://github.com/Azure/azure-rest-api-specs/pull/30787 -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/logProfiles_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettings_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettingsCategories_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/actionGroups_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/activityLogs_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/eventCategories_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/tenantActivityLogs_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metricDefinitions_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/metrics_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/metricBaselines_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/metricAlert_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/vmInsightsOnboarding_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/privateLinkScopes_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/activityLogAlerts_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionEndpoints_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionRuleAssociations_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionRules_API.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Monitor/preview/2023-10-01-preview/azuremonitor.json -- https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Monitor/PipelineGroups/preview/2024-10-01-preview/pipelineGroups.json -# - https://github.com/Azure/azure-rest-api-specs/blob/a9b9241e0d2909e29aa22efb33f55491cbd160de/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/operations_API.json # we do not need to support this +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-10-01/autoscale_API.json +# - https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/operations_API.json # we do not need to support this +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRulesIncidents_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/alertRules_API.json # we should not change this commit because APIs in this file has been deprecated and removed in https://github.com/Azure/azure-rest-api-specs/pull/30787 +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2016-03-01/logProfiles_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettings_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-05-01-preview/diagnosticsSettingsCategories_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2024-10-01-preview/actionGroups_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/activityLogs_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/eventCategories_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2015-04-01/tenantActivityLogs_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-01-01/metricDefinitions_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2021-05-01/metrics_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2019-03-01/metricBaselines_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2018-03-01/metricAlert_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-15/scheduledQueryRule_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2018-11-27-preview/vmInsightsOnboarding_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/preview/2021-07-01-preview/privateLinkScopes_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2020-10-01/activityLogAlerts_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionEndpoints_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionRuleAssociations_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Insights/stable/2022-06-01/dataCollectionRules_API.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Monitor/preview/2023-10-01-preview/azuremonitor.json +- https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Monitor/PipelineGroups/preview/2024-10-01-preview/pipelineGroups.json +# - https://github.com/Azure/azure-rest-api-specs/blob/6a081236fa2ae3c3e759aeb7bd610e550c32ff35/specification/monitor/resource-manager/Microsoft.Monitor/stable/2023-04-03/operations_API.json # we do not need to support this ``` diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..d412000a14bd 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -12,6 +12,7 @@ trigger: - common/ManagementTestShared - common/ManagementCoreShared - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - sdk/analysisservices/Azure.ResourceManager.Analysis @@ -56,6 +57,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 +81,7 @@ trigger: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations + - sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -104,10 +106,12 @@ trigger: - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/impactreporting/Azure.ResourceManager.ImpactReporting - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - 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 @@ -218,6 +222,7 @@ pr: - common/ManagementTestShared - common/ManagementCoreShared - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - sdk/analysisservices/Azure.ResourceManager.Analysis @@ -262,6 +267,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 +291,7 @@ pr: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations + - sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -310,10 +316,12 @@ pr: - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/impactreporting/Azure.ResourceManager.ImpactReporting - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - 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/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.net8.0.cs b/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.net8.0.cs index 6ba77b806a8b..0fc04bdf06eb 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.net8.0.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.net8.0.cs @@ -19,11 +19,31 @@ namespace Azure.ResourceManager.Terraform.Models { public static partial class ArmTerraformModelFactory { - public static Azure.ResourceManager.Terraform.Models.ExportQueryTerraform ExportQueryTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string query = null, string namePattern = null, bool? isRecursive = default(bool?)) { throw null; } + public static Azure.ResourceManager.Terraform.Models.ExportQueryTerraform ExportQueryTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string query = null, string namePattern = null, bool? isRecursive = default(bool?), string table = null, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter? authorizationScopeFilter = default(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter?)) { throw null; } public static Azure.ResourceManager.Terraform.Models.ExportResourceGroupTerraform ExportResourceGroupTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string resourceGroupName = null, string namePattern = null) { throw null; } - public static Azure.ResourceManager.Terraform.Models.TerraformExportResult TerraformExportResult(string configuration = null, System.Collections.Generic.IEnumerable skippedResourceIds = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.ResourceManager.Terraform.Models.TerraformExportResult TerraformExportResult(string configuration = null, string import = null, System.Collections.Generic.IEnumerable skippedResourceIds = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } public static Azure.ResourceManager.Terraform.Models.TerraformOperationStatus TerraformOperationStatus(Azure.ResourceManager.Terraform.Models.TerraformExportResult properties = null, Azure.ResourceManager.Terraform.Models.TerraformResourceProvisioningState status = default(Azure.ResourceManager.Terraform.Models.TerraformResourceProvisioningState), string name = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), double? percentComplete = default(double?), Azure.ResponseError error = null) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthorizationScopeFilter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthorizationScopeFilter(string value) { throw null; } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAboveAndBelow { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAndAbove { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAndBelow { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeExact { get { throw null; } } + public bool Equals(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter 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.Terraform.Models.AuthorizationScopeFilter left, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter right) { throw null; } + public static implicit operator Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter left, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter right) { throw null; } + public override string ToString() { throw null; } + } public abstract partial class CommonExportProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected CommonExportProperties() { } @@ -40,9 +60,11 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ExportQueryTerraform : Azure.ResourceManager.Terraform.Models.CommonExportProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ExportQueryTerraform(string query) { } + public Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter? AuthorizationScopeFilter { get { throw null; } set { } } public bool? IsRecursive { get { throw null; } set { } } public string NamePattern { get { throw null; } set { } } public string Query { get { throw null; } } + public string Table { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Terraform.Models.ExportQueryTerraform 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) { } @@ -99,6 +121,7 @@ public partial class TerraformExportResult : System.ClientModel.Primitives.IJson internal TerraformExportResult() { } public string Configuration { get { throw null; } } public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string Import { get { throw null; } } public System.Collections.Generic.IReadOnlyList SkippedResourceIds { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Terraform.Models.TerraformExportResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.netstandard2.0.cs b/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.netstandard2.0.cs index 6ba77b806a8b..0fc04bdf06eb 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.netstandard2.0.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/api/Azure.ResourceManager.Terraform.netstandard2.0.cs @@ -19,11 +19,31 @@ namespace Azure.ResourceManager.Terraform.Models { public static partial class ArmTerraformModelFactory { - public static Azure.ResourceManager.Terraform.Models.ExportQueryTerraform ExportQueryTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string query = null, string namePattern = null, bool? isRecursive = default(bool?)) { throw null; } + public static Azure.ResourceManager.Terraform.Models.ExportQueryTerraform ExportQueryTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string query = null, string namePattern = null, bool? isRecursive = default(bool?), string table = null, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter? authorizationScopeFilter = default(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter?)) { throw null; } public static Azure.ResourceManager.Terraform.Models.ExportResourceGroupTerraform ExportResourceGroupTerraform(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider? targetProvider = default(Azure.ResourceManager.Terraform.Models.TargetTerraformProvider?), bool? isOutputFullPropertiesEnabled = default(bool?), bool? isMaskSensitiveEnabled = default(bool?), string resourceGroupName = null, string namePattern = null) { throw null; } - public static Azure.ResourceManager.Terraform.Models.TerraformExportResult TerraformExportResult(string configuration = null, System.Collections.Generic.IEnumerable skippedResourceIds = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } + public static Azure.ResourceManager.Terraform.Models.TerraformExportResult TerraformExportResult(string configuration = null, string import = null, System.Collections.Generic.IEnumerable skippedResourceIds = null, System.Collections.Generic.IEnumerable errors = null) { throw null; } public static Azure.ResourceManager.Terraform.Models.TerraformOperationStatus TerraformOperationStatus(Azure.ResourceManager.Terraform.Models.TerraformExportResult properties = null, Azure.ResourceManager.Terraform.Models.TerraformResourceProvisioningState status = default(Azure.ResourceManager.Terraform.Models.TerraformResourceProvisioningState), string name = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), double? percentComplete = default(double?), Azure.ResponseError error = null) { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthorizationScopeFilter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthorizationScopeFilter(string value) { throw null; } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAboveAndBelow { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAndAbove { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeAndBelow { get { throw null; } } + public static Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter AtScopeExact { get { throw null; } } + public bool Equals(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter 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.Terraform.Models.AuthorizationScopeFilter left, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter right) { throw null; } + public static implicit operator Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter left, Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter right) { throw null; } + public override string ToString() { throw null; } + } public abstract partial class CommonExportProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected CommonExportProperties() { } @@ -40,9 +60,11 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public partial class ExportQueryTerraform : Azure.ResourceManager.Terraform.Models.CommonExportProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { public ExportQueryTerraform(string query) { } + public Azure.ResourceManager.Terraform.Models.AuthorizationScopeFilter? AuthorizationScopeFilter { get { throw null; } set { } } public bool? IsRecursive { get { throw null; } set { } } public string NamePattern { get { throw null; } set { } } public string Query { get { throw null; } } + public string Table { get { throw null; } set { } } protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Terraform.Models.ExportQueryTerraform 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) { } @@ -99,6 +121,7 @@ public partial class TerraformExportResult : System.ClientModel.Primitives.IJson internal TerraformExportResult() { } public string Configuration { get { throw null; } } public System.Collections.Generic.IReadOnlyList Errors { get { throw null; } } + public string Import { get { throw null; } } public System.Collections.Generic.IReadOnlyList SkippedResourceIds { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.Terraform.Models.TerraformExportResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/ArmTerraformModelFactory.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/ArmTerraformModelFactory.cs index 72b56c7b2a60..ba1de21e590c 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/ArmTerraformModelFactory.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/ArmTerraformModelFactory.cs @@ -22,8 +22,10 @@ public static partial class ArmTerraformModelFactory /// The ARG where predicate. Note that you can combine multiple conditions in one `where` predicate, e.g. `resourceGroup =~ "my-rg" and type =~ "microsoft.network/virtualnetworks"`. /// The name pattern of the Terraform resources. /// Whether to recursively list child resources of the query result. + /// The ARG table name. + /// The ARG Scope Filter parameter. /// A new instance for mocking. - public static ExportQueryTerraform ExportQueryTerraform(TargetTerraformProvider? targetProvider = null, bool? isOutputFullPropertiesEnabled = null, bool? isMaskSensitiveEnabled = null, string query = null, string namePattern = null, bool? isRecursive = null) + public static ExportQueryTerraform ExportQueryTerraform(TargetTerraformProvider? targetProvider = null, bool? isOutputFullPropertiesEnabled = null, bool? isMaskSensitiveEnabled = null, string query = null, string namePattern = null, bool? isRecursive = null, string table = null, AuthorizationScopeFilter? authorizationScopeFilter = null) { return new ExportQueryTerraform( CommonExportType.ExportQuery, @@ -33,7 +35,9 @@ public static ExportQueryTerraform ExportQueryTerraform(TargetTerraformProvider? serializedAdditionalRawData: null, query, namePattern, - isRecursive); + isRecursive, + table, + authorizationScopeFilter); } /// Initializes a new instance of . @@ -79,15 +83,16 @@ public static TerraformOperationStatus TerraformOperationStatus(TerraformExportR /// Initializes a new instance of . /// The Terraform configuration content. + /// The Terraform import blocks for the current export, which users can use to run "terraform plan" with to import the resources. /// A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform. /// A list of errors derived during exporting each resource. /// A new instance for mocking. - public static TerraformExportResult TerraformExportResult(string configuration = null, IEnumerable skippedResourceIds = null, IEnumerable errors = null) + public static TerraformExportResult TerraformExportResult(string configuration = null, string import = null, IEnumerable skippedResourceIds = null, IEnumerable errors = null) { skippedResourceIds ??= new List(); errors ??= new List(); - return new TerraformExportResult(configuration, skippedResourceIds?.ToList(), errors?.ToList(), serializedAdditionalRawData: null); + return new TerraformExportResult(configuration, import, skippedResourceIds?.ToList(), errors?.ToList(), serializedAdditionalRawData: null); } } } diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/AuthorizationScopeFilter.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/AuthorizationScopeFilter.cs new file mode 100644 index 000000000000..70c537b28d37 --- /dev/null +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/AuthorizationScopeFilter.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.Terraform.Models +{ + /// The Azure Resource Graph Authorization Scope Filter parameter. + public readonly partial struct AuthorizationScopeFilter : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthorizationScopeFilter(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AtScopeAndBelowValue = "AtScopeAndBelow"; + private const string AtScopeAndAboveValue = "AtScopeAndAbove"; + private const string AtScopeAboveAndBelowValue = "AtScopeAboveAndBelow"; + private const string AtScopeExactValue = "AtScopeExact"; + + /// Returns assignments for the given scope and all child scopes. + public static AuthorizationScopeFilter AtScopeAndBelow { get; } = new AuthorizationScopeFilter(AtScopeAndBelowValue); + /// Returns assignments for the given scope and all parent scopes, but not child scopes. + public static AuthorizationScopeFilter AtScopeAndAbove { get; } = new AuthorizationScopeFilter(AtScopeAndAboveValue); + /// Returns assignments for the given scope, all parent scopes, and all child scopes. + public static AuthorizationScopeFilter AtScopeAboveAndBelow { get; } = new AuthorizationScopeFilter(AtScopeAboveAndBelowValue); + /// Returns assignments only for the given scope; no parent or child scopes are included. + public static AuthorizationScopeFilter AtScopeExact { get; } = new AuthorizationScopeFilter(AtScopeExactValue); + /// Determines if two values are the same. + public static bool operator ==(AuthorizationScopeFilter left, AuthorizationScopeFilter right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthorizationScopeFilter left, AuthorizationScopeFilter right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthorizationScopeFilter(string value) => new AuthorizationScopeFilter(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthorizationScopeFilter other && Equals(other); + /// + public bool Equals(AuthorizationScopeFilter 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/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.Serialization.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.Serialization.cs index 78e075500430..f5ed9d89d081 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.Serialization.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.Serialization.cs @@ -47,6 +47,16 @@ protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("recursive"u8); writer.WriteBooleanValue(IsRecursive.Value); } + if (Optional.IsDefined(Table)) + { + writer.WritePropertyName("table"u8); + writer.WriteStringValue(Table); + } + if (Optional.IsDefined(AuthorizationScopeFilter)) + { + writer.WritePropertyName("authorizationScopeFilter"u8); + writer.WriteStringValue(AuthorizationScopeFilter.Value.ToString()); + } } ExportQueryTerraform IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) @@ -72,6 +82,8 @@ internal static ExportQueryTerraform DeserializeExportQueryTerraform(JsonElement string query = default; string namePattern = default; bool? recursive = default; + string table = default; + AuthorizationScopeFilter? authorizationScopeFilter = default; CommonExportType type = default; TargetTerraformProvider? targetProvider = default; bool? fullProperties = default; @@ -99,6 +111,20 @@ internal static ExportQueryTerraform DeserializeExportQueryTerraform(JsonElement recursive = property.Value.GetBoolean(); continue; } + if (property.NameEquals("table"u8)) + { + table = property.Value.GetString(); + continue; + } + if (property.NameEquals("authorizationScopeFilter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authorizationScopeFilter = new AuthorizationScopeFilter(property.Value.GetString()); + continue; + } if (property.NameEquals("type"u8)) { type = new CommonExportType(property.Value.GetString()); @@ -145,7 +171,9 @@ internal static ExportQueryTerraform DeserializeExportQueryTerraform(JsonElement serializedAdditionalRawData, query, namePattern, - recursive); + recursive, + table, + authorizationScopeFilter); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.cs index 2d7c71a05d0c..13812280ac56 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/ExportQueryTerraform.cs @@ -33,11 +33,15 @@ public ExportQueryTerraform(string query) /// The ARG where predicate. Note that you can combine multiple conditions in one `where` predicate, e.g. `resourceGroup =~ "my-rg" and type =~ "microsoft.network/virtualnetworks"`. /// The name pattern of the Terraform resources. /// Whether to recursively list child resources of the query result. - internal ExportQueryTerraform(CommonExportType type, TargetTerraformProvider? targetProvider, bool? isOutputFullPropertiesEnabled, bool? isMaskSensitiveEnabled, IDictionary serializedAdditionalRawData, string query, string namePattern, bool? isRecursive) : base(type, targetProvider, isOutputFullPropertiesEnabled, isMaskSensitiveEnabled, serializedAdditionalRawData) + /// The ARG table name. + /// The ARG Scope Filter parameter. + internal ExportQueryTerraform(CommonExportType type, TargetTerraformProvider? targetProvider, bool? isOutputFullPropertiesEnabled, bool? isMaskSensitiveEnabled, IDictionary serializedAdditionalRawData, string query, string namePattern, bool? isRecursive, string table, AuthorizationScopeFilter? authorizationScopeFilter) : base(type, targetProvider, isOutputFullPropertiesEnabled, isMaskSensitiveEnabled, serializedAdditionalRawData) { Query = query; NamePattern = namePattern; IsRecursive = isRecursive; + Table = table; + AuthorizationScopeFilter = authorizationScopeFilter; Type = type; } @@ -52,5 +56,9 @@ internal ExportQueryTerraform() public string NamePattern { get; set; } /// Whether to recursively list child resources of the query result. public bool? IsRecursive { get; set; } + /// The ARG table name. + public string Table { get; set; } + /// The ARG Scope Filter parameter. + public AuthorizationScopeFilter? AuthorizationScopeFilter { get; set; } } } diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.Serialization.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.Serialization.cs index e08eb4e6a8c7..2cf047f63e9d 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.Serialization.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.Serialization.cs @@ -39,6 +39,11 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("configuration"u8); writer.WriteStringValue(Configuration); } + if (Optional.IsDefined(Import)) + { + writer.WritePropertyName("import"u8); + writer.WriteStringValue(Import); + } if (Optional.IsCollectionDefined(SkippedResourceIds)) { writer.WritePropertyName("skippedResources"u8); @@ -102,6 +107,7 @@ internal static TerraformExportResult DeserializeTerraformExportResult(JsonEleme return null; } string configuration = default; + string import = default; IReadOnlyList skippedResources = default; IReadOnlyList errors = default; IDictionary serializedAdditionalRawData = default; @@ -113,6 +119,11 @@ internal static TerraformExportResult DeserializeTerraformExportResult(JsonEleme configuration = property.Value.GetString(); continue; } + if (property.NameEquals("import"u8)) + { + import = property.Value.GetString(); + continue; + } if (property.NameEquals("skippedResources"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -154,7 +165,7 @@ internal static TerraformExportResult DeserializeTerraformExportResult(JsonEleme } } serializedAdditionalRawData = rawDataDictionary; - return new TerraformExportResult(configuration, skippedResources ?? new ChangeTrackingList(), errors ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new TerraformExportResult(configuration, import, skippedResources ?? new ChangeTrackingList(), errors ?? new ChangeTrackingList(), serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.cs b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.cs index 68a442fa99f7..2151ce67b5c2 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.cs +++ b/sdk/terraform/Azure.ResourceManager.Terraform/src/Generated/Models/TerraformExportResult.cs @@ -55,12 +55,14 @@ internal TerraformExportResult() /// Initializes a new instance of . /// The Terraform configuration content. + /// The Terraform import blocks for the current export, which users can use to run "terraform plan" with to import the resources. /// A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform. /// A list of errors derived during exporting each resource. /// Keeps track of any properties unknown to the library. - internal TerraformExportResult(string configuration, IReadOnlyList skippedResourceIds, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + internal TerraformExportResult(string configuration, string import, IReadOnlyList skippedResourceIds, IReadOnlyList errors, IDictionary serializedAdditionalRawData) { Configuration = configuration; + Import = import; SkippedResourceIds = skippedResourceIds; Errors = errors; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -68,6 +70,8 @@ internal TerraformExportResult(string configuration, IReadOnlyList The Terraform configuration content. public string Configuration { get; } + /// The Terraform import blocks for the current export, which users can use to run "terraform plan" with to import the resources. + public string Import { get; } /// A list of Azure resources which are not exported to Terraform due to there is no corresponding resources in Terraform. public IReadOnlyList SkippedResourceIds { get; } /// A list of errors derived during exporting each resource. diff --git a/sdk/terraform/Azure.ResourceManager.Terraform/tsp-location.yaml b/sdk/terraform/Azure.ResourceManager.Terraform/tsp-location.yaml index d676e0dde7f9..1edbe0e7625f 100644 --- a/sdk/terraform/Azure.ResourceManager.Terraform/tsp-location.yaml +++ b/sdk/terraform/Azure.ResourceManager.Terraform/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/terraform/Microsoft.AzureTerraform.Management -commit: a4fc4c6bda9ff2315671bca69f9de40a43e2bd8c +commit: 6a081236fa2ae3c3e759aeb7bd610e550c32ff35 repo: Azure/azure-rest-api-specs +additionalDirectories: