From 9ce301a0957ca5c829f4720825bdd63c421bbeec Mon Sep 17 00:00:00 2001 From: Anthony Martin <38542602+anthony-c-martin@users.noreply.github.com> Date: Thu, 26 Jun 2025 22:35:30 -0400 Subject: [PATCH] Initial release for Azure.ResourceManager.Resources.Deployments --- ....ResourceManager.Resources.Deployments.sln | 65 + .../CHANGELOG.md | 19 + .../Directory.Build.props | 6 + .../README.md | 80 + ...rceManager.Resources.Deployments.net8.0.cs | 985 ++++++++++++ ...er.Resources.Deployments.netstandard2.0.cs | 985 ++++++++++++ .../assets.json | 6 + ...nager.Resources.Deployments.Samples.csproj | 10 + ...sourceManager.Resources.Deployments.csproj | 8 + .../Model/ArmDeploymentPropertiesExtended.cs | 43 + .../src/Custom/Model/SubResource.cs | 15 + .../src/Generated/ArmDeploymentCollection.cs | 489 ++++++ .../ArmDeploymentData.Serialization.cs | 337 ++++ .../src/Generated/ArmDeploymentData.cs | 87 + .../ArmDeploymentResource.Serialization.cs | 29 + .../src/Generated/ArmDeploymentResource.cs | 1413 +++++++++++++++++ .../ArmResourcesDeploymentsModelFactory.cs | 646 ++++++++ .../MockableResourcesDeploymentsArmClient.cs | 49 + ...urcesDeploymentsManagementGroupResource.cs | 105 ++ ...sourcesDeploymentsResourceGroupResource.cs | 105 ++ ...esourcesDeploymentsSubscriptionResource.cs | 105 ++ ...kableResourcesDeploymentsTenantResource.cs | 197 +++ .../ResourcesDeploymentsExtensions.cs | 509 ++++++ .../src/Generated/Internal/Argument.cs | 129 ++ .../Internal/BicepSerializationHelpers.cs | 58 + .../Internal/ChangeTrackingDictionary.cs | 167 ++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++ .../Internal/ModelSerializationExtensions.cs | 425 +++++ .../src/Generated/Internal/Optional.cs | 51 + .../Internal/Utf8JsonRequestContent.cs | 55 + .../Generated/Internal/WirePathAttribute.cs | 27 + .../ArmDeploymentOperationSource.cs | 36 + ...DeploymentValidateResultOperationSource.cs | 30 + .../DeploymentsArmOperation.cs | 94 ++ .../DeploymentsArmOperationOfT.cs | 100 ++ .../WhatIfOperationResultOperationSource.cs | 30 + .../Models/ApiProfile.Serialization.cs | 204 +++ .../src/Generated/Models/ApiProfile.cs | 71 + .../Models/ArmDependency.Serialization.cs | 283 ++++ .../src/Generated/Models/ArmDependency.cs | 83 + .../ArmDeploymentContent.Serialization.cs | 182 +++ .../Generated/Models/ArmDeploymentContent.cs | 93 ++ ...ArmDeploymentExportResult.Serialization.cs | 173 ++ .../Models/ArmDeploymentExportResult.cs | 95 ++ ...oymentExtensionConfigItem.Serialization.cs | 233 +++ .../ArmDeploymentExtensionConfigItem.cs | 105 ++ ...oymentExtensionDefinition.Serialization.cs | 329 ++++ .../ArmDeploymentExtensionDefinition.cs | 87 + ...rmDeploymentExternalInput.Serialization.cs | 133 ++ .../Models/ArmDeploymentExternalInput.cs | 105 ++ ...ntExternalInputDefinition.Serialization.cs | 148 ++ .../ArmDeploymentExternalInputDefinition.cs | 110 ++ .../ArmDeploymentListResult.Serialization.cs | 219 +++ .../Models/ArmDeploymentListResult.cs | 70 + .../Models/ArmDeploymentMode.Serialization.cs | 28 + .../src/Generated/Models/ArmDeploymentMode.cs | 18 + .../ArmDeploymentOperation.Serialization.cs | 234 +++ .../Models/ArmDeploymentOperation.cs | 76 + ...oymentOperationProperties.Serialization.cs | 475 ++++++ .../ArmDeploymentOperationProperties.cs | 180 +++ ...ymentOperationsListResult.Serialization.cs | 219 +++ .../ArmDeploymentOperationsListResult.cs | 70 + ...mDeploymentParametersLink.Serialization.cs | 193 +++ .../Models/ArmDeploymentParametersLink.cs | 81 + .../ArmDeploymentProperties.Serialization.cs | 374 +++++ .../Models/ArmDeploymentProperties.cs | 213 +++ ...loymentPropertiesExtended.Serialization.cs | 893 +++++++++++ .../Models/ArmDeploymentPropertiesExtended.cs | 225 +++ ...ArmDeploymentTemplateLink.Serialization.cs | 308 ++++ .../Models/ArmDeploymentTemplateLink.cs | 86 + ...mDeploymentValidateResult.Serialization.cs | 271 ++++ .../Models/ArmDeploymentValidateResult.cs | 77 + ...rmDeploymentWhatIfContent.Serialization.cs | 141 ++ .../Models/ArmDeploymentWhatIfContent.cs | 82 + ...eploymentWhatIfProperties.Serialization.cs | 276 ++++ .../Models/ArmDeploymentWhatIfProperties.cs | 62 + ...mDeploymentWhatIfSettings.Serialization.cs | 133 ++ .../Models/ArmDeploymentWhatIfSettings.cs | 66 + .../ArmResourceReference.Serialization.cs | 307 ++++ .../Generated/Models/ArmResourceReference.cs | 116 ++ ...ourceManagerResourcesDeploymentsContext.cs | 19 + .../BasicArmDependency.Serialization.cs | 234 +++ .../Generated/Models/BasicArmDependency.cs | 77 + .../Models/DebugSetting.Serialization.cs | 170 ++ .../src/Generated/Models/DebugSetting.cs | 66 + ...mentDiagnosticsDefinition.Serialization.cs | 316 ++++ .../Models/DeploymentDiagnosticsDefinition.cs | 98 ++ .../DeploymentIdentity.Serialization.cs | 153 ++ .../Generated/Models/DeploymentIdentity.cs | 80 + .../Models/DeploymentIdentityType.cs | 51 + .../ErrorAdditionalInfo.Serialization.cs | 207 +++ .../Generated/Models/ErrorAdditionalInfo.cs | 100 ++ .../Models/ErrorDeployment.Serialization.cs | 144 ++ .../src/Generated/Models/ErrorDeployment.cs | 71 + .../ErrorDeploymentExtended.Serialization.cs | 234 +++ .../Models/ErrorDeploymentExtended.cs | 76 + .../ErrorDeploymentType.Serialization.cs | 28 + .../Generated/Models/ErrorDeploymentType.cs | 18 + ...pressionEvaluationOptions.Serialization.cs | 133 ++ .../Models/ExpressionEvaluationOptions.cs | 66 + .../Models/ExpressionEvaluationScope.cs | 54 + .../Models/ExtensionConfigPropertyType.cs | 66 + .../Models/HttpMessage.Serialization.cs | 173 ++ .../src/Generated/Models/HttpMessage.cs | 95 ++ ...eyVaultParameterReference.Serialization.cs | 228 +++ .../Models/KeyVaultParameterReference.cs | 103 ++ .../src/Generated/Models/Level.cs | 54 + .../Models/Provider.Serialization.cs | 358 +++++ .../src/Generated/Models/Provider.cs | 92 ++ .../ProviderAuthorizationConsentState.cs | 57 + .../ProviderExtendedLocation.Serialization.cs | 262 +++ .../Models/ProviderExtendedLocation.cs | 78 + .../ProviderResourceType.Serialization.cs | 627 ++++++++ .../Generated/Models/ProviderResourceType.cs | 118 ++ ...ProvisioningOperationKind.Serialization.cs | 44 + .../Models/ProvisioningOperationKind.cs | 34 + .../Models/ResourceTypeAlias.Serialization.cs | 350 ++++ .../src/Generated/Models/ResourceTypeAlias.cs | 92 ++ .../ResourceTypeAliasPath.Serialization.cs | 292 ++++ .../Generated/Models/ResourceTypeAliasPath.cs | 82 + .../Models/ResourceTypeAliasPathAttribute.cs | 51 + ...urceTypeAliasPathMetadata.Serialization.cs | 196 +++ .../Models/ResourceTypeAliasPathMetadata.cs | 71 + .../Models/ResourceTypeAliasPathTokenType.cs | 69 + .../ResourceTypeAliasPattern.Serialization.cs | 234 +++ .../Models/ResourceTypeAliasPattern.cs | 76 + ...ourceTypeAliasPatternType.Serialization.cs | 28 + .../Models/ResourceTypeAliasPatternType.cs | 18 + .../ResourceTypeAliasType.Serialization.cs | 30 + .../Generated/Models/ResourceTypeAliasType.cs | 20 + .../Models/ResourcesProvisioningState.cs | 81 + .../Models/StatusMessage.Serialization.cs | 200 +++ .../src/Generated/Models/StatusMessage.cs | 71 + .../Models/TargetResource.Serialization.cs | 377 +++++ .../src/Generated/Models/TargetResource.cs | 126 ++ .../TemplateHashResult.Serialization.cs | 204 +++ .../Generated/Models/TemplateHashResult.cs | 71 + .../src/Generated/Models/ValidationLevel.cs | 54 + .../Models/WhatIfChange.Serialization.cs | 493 ++++++ .../src/Generated/Models/WhatIfChange.cs | 206 +++ .../Models/WhatIfChangeType.Serialization.cs | 38 + .../src/Generated/Models/WhatIfChangeType.cs | 28 + .../WhatIfOperationResult.Serialization.cs | 369 +++++ .../Generated/Models/WhatIfOperationResult.cs | 89 ++ .../WhatIfPropertyChange.Serialization.cs | 316 ++++ .../Generated/Models/WhatIfPropertyChange.cs | 157 ++ .../WhatIfPropertyChangeType.Serialization.cs | 34 + .../Models/WhatIfPropertyChangeType.cs | 24 + .../WhatIfResultFormat.Serialization.cs | 28 + .../Generated/Models/WhatIfResultFormat.cs | 18 + .../Models/ZoneMapping.Serialization.cs | 228 +++ .../src/Generated/Models/ZoneMapping.cs | 73 + .../src/Generated/ProviderConstants.cs | 16 + .../DeploymentRestOperations.cs | 309 ++++ .../DeploymentsRestOperations.cs | 1214 ++++++++++++++ .../src/GlobalSuppressions.cs | 8 + .../src/Properties/AssemblyInfo.cs | 9 + .../src/autorest.md | 271 ++++ ...Manager.Resources.Deployments.Tests.csproj | 13 + .../tests/DeploymentsManagementTestBase.cs | 43 + .../DeploymentsManagementTestEnvironment.cs | 11 + .../Samples/Sample_ArmDeploymentCollection.cs | 68 + .../Samples/Sample_ArmDeploymentResource.cs | 249 +++ .../Sample_TenantResourceExtensions.cs | 82 + .../tests/ResourcesTestBase.cs | 113 ++ .../tests/ResourcesTestEnvironment.cs | 11 + .../Scenario/DeploymentCollectionTests.cs | 195 +++ .../DeploymentOperationCollectionTests.cs | 96 ++ .../Scenario/DeploymentOperationsTests.cs | 58 + .../mg-stack-template.json | 16 + .../rg-stack-template.json | 24 + .../simple-storage-account.json | 22 + .../storage-parameters.json | 5 + .../DeploymentTemplates/storage-template.json | 68 + .../sub-stack-template.json | 22 + sdk/resources/ci.mgmt.yml | 3 + 176 files changed, 28179 insertions(+) create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/Azure.ResourceManager.Resources.Deployments.sln create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/CHANGELOG.md create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/Directory.Build.props create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/README.md create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.net8.0.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.netstandard2.0.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/assets.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/samples/Azure.ResourceManager.Resources.Deployments.Samples.csproj create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Azure.ResourceManager.Resources.Deployments.csproj create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/ArmDeploymentPropertiesExtended.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/SubResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentCollection.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmResourcesDeploymentsModelFactory.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsArmClient.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsManagementGroupResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsResourceGroupResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsSubscriptionResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsTenantResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/ResourcesDeploymentsExtensions.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Argument.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/BicepSerializationHelpers.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Optional.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/WirePathAttribute.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentOperationSource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentValidateResultOperationSource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperation.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperationOfT.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/WhatIfOperationResultOperationSource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/AzureResourceManagerResourcesDeploymentsContext.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentityType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationScope.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExtensionConfigPropertyType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Level.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderAuthorizationConsentState.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathAttribute.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathTokenType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourcesProvisioningState.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ValidationLevel.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.Serialization.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ProviderConstants.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentRestOperations.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentsRestOperations.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/GlobalSuppressions.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Properties/AssemblyInfo.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/src/autorest.md create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Azure.ResourceManager.Resources.Deployments.Tests.csproj create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestBase.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestEnvironment.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentCollection.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentResource.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_TenantResourceExtensions.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestBase.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestEnvironment.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentCollectionTests.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationCollectionTests.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationsTests.cs create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/mg-stack-template.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/rg-stack-template.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/simple-storage-account.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-parameters.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-template.json create mode 100644 sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/sub-stack-template.json diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/Azure.ResourceManager.Resources.Deployments.sln b/sdk/resources/Azure.ResourceManager.Resources.Deployments/Azure.ResourceManager.Resources.Deployments.sln new file mode 100644 index 000000000000..592f13fc8421 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/Azure.ResourceManager.Resources.Deployments.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{253F8803-5FF3-4345-A524-F318A4F8C4F2}") = "Azure.ResourceManager.Resources.Deployments", "src\Azure.ResourceManager.Resources.Deployments.csproj", "{70707234-62A2-48BF-A674-485AB4E6DF75}" +EndProject +Project("{253F8803-5FF3-4345-A524-F318A4F8C4F2}") = "Azure.ResourceManager.Resources.Deployments.Tests", "tests\Azure.ResourceManager.Resources.Deployments.Tests.csproj", "{DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}" +EndProject +Project("{253F8803-5FF3-4345-A524-F318A4F8C4F2}") = "Azure.ResourceManager.Resources.Deployments.Samples", "samples\Azure.ResourceManager.Resources.Deployments.Samples.csproj", "{D64D92DA-48F2-4EA6-A444-90BAE6A99B45}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {DE5873FE-D480-4F0F-A3A1-A0CF4C4028D2} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|Any CPU.Build.0 = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|x64.ActiveCfg = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|x64.Build.0 = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|x86.ActiveCfg = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Debug|x86.Build.0 = Debug|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|Any CPU.ActiveCfg = Release|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|Any CPU.Build.0 = Release|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|x64.ActiveCfg = Release|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|x64.Build.0 = Release|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|x86.ActiveCfg = Release|Any CPU + {70707234-62A2-48BF-A674-485AB4E6DF75}.Release|x86.Build.0 = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|x64.ActiveCfg = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|x64.Build.0 = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|x86.ActiveCfg = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Debug|x86.Build.0 = Debug|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|Any CPU.Build.0 = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|x64.ActiveCfg = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|x64.Build.0 = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|x86.ActiveCfg = Release|Any CPU + {DEBFD95F-D4F9-4054-9EE9-A9930E2E3DC6}.Release|x86.Build.0 = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|x64.ActiveCfg = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|x64.Build.0 = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|x86.ActiveCfg = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Debug|x86.Build.0 = Debug|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|Any CPU.Build.0 = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|x64.ActiveCfg = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|x64.Build.0 = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|x86.ActiveCfg = Release|Any CPU + {D64D92DA-48F2-4EA6-A444-90BAE6A99B45}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/CHANGELOG.md b/sdk/resources/Azure.ResourceManager.Resources.Deployments/CHANGELOG.md new file mode 100644 index 000000000000..1a85987a15b9 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/CHANGELOG.md @@ -0,0 +1,19 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + + + +### Features Added + +This package 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. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/Directory.Build.props b/sdk/resources/Azure.ResourceManager.Resources.Deployments/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/README.md b/sdk/resources/Azure.ResourceManager.Resources.Deployments/README.md new file mode 100644 index 000000000000..a19ba5e8c216 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Resources.Deployments 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 Resources.Deployments management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Resources.Deployments --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://docs.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/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.net8.0.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.net8.0.cs new file mode 100644 index 000000000000..b903f92a49fa --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.net8.0.cs @@ -0,0 +1,985 @@ +namespace Azure.ResourceManager.Resources.Deployments +{ + public partial class ArmDeploymentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArmDeploymentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string deploymentName, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string deploymentName, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string deploymentName, 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 ArmDeploymentData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentData() { } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended Properties { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.ArmDeploymentData 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 ArmDeploymentResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArmDeploymentResource() { } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentData 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 virtual Azure.Response Cancel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistence(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string scope, string deploymentName) { 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 ExportTemplate(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAsync(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 GetDeploymentOperation(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeploymentOperationAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeploymentOperations(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentOperationsAsync(int? top = default(int?), 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.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Validate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation WhatIf(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> WhatIfAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AzureResourceManagerResourcesDeploymentsContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerResourcesDeploymentsContext() { } + public static Azure.ResourceManager.Resources.Deployments.AzureResourceManagerResourcesDeploymentsContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class ResourcesDeploymentsExtensions + { + public static Azure.Response CalculateDeploymentTemplateHash(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CalculateDeploymentTemplateHashAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.TenantResource tenantResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentResource GetArmDeploymentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.TenantResource tenantResource) { throw null; } + } +} +namespace Azure.ResourceManager.Resources.Deployments.Mocking +{ + public partial class MockableResourcesDeploymentsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsArmClient() { } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentResource GetArmDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourcesDeploymentsManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsManagementGroupResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsResourceGroupResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsSubscriptionResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsTenantResource() { } + public virtual Azure.Response CalculateDeploymentTemplateHash(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateDeploymentTemplateHashAsync(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } +} +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ApiProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ApiProfile() { } + public string ApiVersion { get { throw null; } } + public string ProfileVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ApiProfile 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.Resources.Deployments.Models.ApiProfile 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 ArmDependency : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDependency() { } + public System.Collections.Generic.IReadOnlyList DependsOn { get { throw null; } } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDependency 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.Resources.Deployments.Models.ArmDependency 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 ArmDeploymentContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentContent(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties properties) { } + public Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity Identity { get { throw null; } set { } } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties Properties { get { throw null; } } + 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.Resources.Deployments.Models.ArmDeploymentContent 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.Resources.Deployments.Models.ArmDeploymentContent 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 ArmDeploymentExportResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentExportResult() { } + public System.BinaryData Template { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExportResult 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.Resources.Deployments.Models.ArmDeploymentExportResult 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 ArmDeploymentExtensionConfigItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExtensionConfigItem() { } + public Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType? ExtensionConfigPropertyType { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference KeyVaultReference { get { throw null; } set { } } + public System.BinaryData Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem 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.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem 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 ArmDeploymentExtensionDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentExtensionDefinition() { } + public string Alias { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Config { get { throw null; } } + public string ConfigId { get { throw null; } } + public string Name { 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.Resources.Deployments.Models.ArmDeploymentExtensionDefinition 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.Resources.Deployments.Models.ArmDeploymentExtensionDefinition 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 ArmDeploymentExternalInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExternalInput(System.BinaryData value) { } + public System.BinaryData Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInput 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.Resources.Deployments.Models.ArmDeploymentExternalInput 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 ArmDeploymentExternalInputDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExternalInputDefinition(string kind) { } + public System.BinaryData Config { get { throw null; } set { } } + public string Kind { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition 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.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition 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 ArmDeploymentMode + { + Incremental = 0, + Complete = 1, + } + public partial class ArmDeploymentOperation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentOperation() { } + public string Id { get { throw null; } } + public string OperationId { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties Properties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperation 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.Resources.Deployments.Models.ArmDeploymentOperation 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 ArmDeploymentOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentOperationProperties() { } + public System.TimeSpan? Duration { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind? ProvisioningOperation { get { throw null; } } + public string ProvisioningState { get { throw null; } } + public System.BinaryData RequestContent { get { throw null; } } + public System.BinaryData ResponseContent { get { throw null; } } + public string ServiceRequestId { get { throw null; } } + public string StatusCode { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.StatusMessage StatusMessage { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.TargetResource TargetResource { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties 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.Resources.Deployments.Models.ArmDeploymentOperationProperties 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 ArmDeploymentParametersLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentParametersLink(System.Uri uri) { } + public string ContentVersion { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink 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.Resources.Deployments.Models.ArmDeploymentParametersLink 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 ArmDeploymentProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentProperties(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode) { } + public string DebugSettingDetailLevel { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment ErrorDeployment { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? ExpressionEvaluationScope { get { throw null; } set { } } + public System.Collections.Generic.IDictionary> ExtensionConfigs { get { throw null; } } + public System.Collections.Generic.IDictionary ExternalInputDefinitions { get { throw null; } } + public System.Collections.Generic.IDictionary ExternalInputs { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode Mode { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink ParametersLink { get { throw null; } set { } } + public System.BinaryData Template { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink TemplateLink { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? ValidationLevel { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties 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.Resources.Deployments.Models.ArmDeploymentProperties 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 ArmDeploymentPropertiesExtended : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentPropertiesExtended() { } + public string CorrelationId { get { throw null; } } + public string DebugSettingDetailLevel { get { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] set { } } + public System.Collections.Generic.IReadOnlyList Dependencies { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Diagnostics { get { throw null; } } + public System.TimeSpan? Duration { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended ErrorDeployment { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Extensions { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode? Mode { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutputResourceDetails { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public System.Collections.Generic.IReadOnlyList OutputResources { get { throw null; } } + public System.BinaryData Outputs { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink ParametersLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Providers { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState? ProvisioningState { get { throw null; } } + public string TemplateHash { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink TemplateLink { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ValidatedResourceDetails { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public System.Collections.Generic.IReadOnlyList ValidatedResources { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? ValidationLevel { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended 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.Resources.Deployments.Models.ArmDeploymentPropertiesExtended 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 ArmDeploymentTemplateLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentTemplateLink() { } + public string ContentVersion { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public string QueryString { get { throw null; } set { } } + public string RelativePath { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink 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.Resources.Deployments.Models.ArmDeploymentTemplateLink 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 ArmDeploymentValidateResult : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentValidateResult() { } + public Azure.ResponseError Error { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentValidateResult 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.Resources.Deployments.Models.ArmDeploymentValidateResult 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 ArmDeploymentWhatIfContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentWhatIfContent(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties properties) { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties Properties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent 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.Resources.Deployments.Models.ArmDeploymentWhatIfContent 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 ArmDeploymentWhatIfProperties : Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentWhatIfProperties(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode) : base (default(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode)) { } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat? WhatIfResultFormat { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties 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.Resources.Deployments.Models.ArmDeploymentWhatIfProperties 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 ArmResourceReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmResourceReference() { } + public string ApiVersion { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public Azure.Core.ResourceIdentifier Id { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmResourceReference 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.Resources.Deployments.Models.ArmResourceReference 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 ArmResourcesDeploymentsModelFactory + { + public static Azure.ResourceManager.Resources.Deployments.Models.ApiProfile ApiProfile(string profileVersion = null, string apiVersion = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDependency ArmDependency(System.Collections.Generic.IEnumerable dependsOn = null, string id = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string resourceName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent ArmDeploymentContent(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties properties = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity identity = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentData ArmDeploymentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended properties = null, System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExportResult ArmDeploymentExportResult(System.BinaryData template = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem ArmDeploymentExtensionConfigItem(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType? extensionConfigPropertyType = default(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType?), System.BinaryData value = null, Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference keyVaultReference = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition ArmDeploymentExtensionDefinition(string alias = null, string name = null, string version = null, string configId = null, System.Collections.Generic.IReadOnlyDictionary config = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition ArmDeploymentExternalInputDefinition(string kind = null, System.BinaryData config = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperation ArmDeploymentOperation(string id = null, string operationId = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties ArmDeploymentOperationProperties(Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind? provisioningOperation = default(Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind?), string provisioningState = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.TimeSpan? duration = default(System.TimeSpan?), string serviceRequestId = null, string statusCode = null, Azure.ResourceManager.Resources.Deployments.Models.StatusMessage statusMessage = null, Azure.ResourceManager.Resources.Deployments.Models.TargetResource targetResource = null, System.BinaryData requestContent = null, System.BinaryData responseContent = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties ArmDeploymentProperties(System.BinaryData template = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, System.Collections.Generic.IDictionary externalInputs = null, System.Collections.Generic.IDictionary externalInputDefinitions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IDictionary> extensionConfigs = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode = Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode.Incremental, string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment errorDeployment = null, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? expressionEvaluationScope = default(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope?), Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended ArmDeploymentPropertiesExtended(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState? provisioningState = default(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState?), string correlationId = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.TimeSpan? duration = default(System.TimeSpan?), System.BinaryData outputs = null, System.Collections.Generic.IEnumerable providers = null, System.Collections.Generic.IEnumerable dependencies = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IEnumerable extensions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode? mode = default(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode?), string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended errorDeployment = null, string templateHash = null, System.Collections.Generic.IEnumerable outputResourceDetails = null, System.Collections.Generic.IEnumerable validatedResourceDetails = null, Azure.ResponseError error = null, System.Collections.Generic.IEnumerable diagnostics = null, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentValidateResult ArmDeploymentValidateResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResponseError error = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent ArmDeploymentWhatIfContent(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties ArmDeploymentWhatIfProperties(System.BinaryData template = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, System.Collections.Generic.IDictionary externalInputs = null, System.Collections.Generic.IDictionary externalInputDefinitions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IDictionary> extensionConfigs = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode = Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode.Incremental, string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment errorDeployment = null, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? expressionEvaluationScope = default(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope?), Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?), Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat? whatIfResultFormat = default(Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmResourceReference ArmResourceReference(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, string resourceType = null, System.BinaryData identifiers = null, string apiVersion = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.BasicArmDependency BasicArmDependency(string id = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string resourceName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentDiagnosticsDefinition DeploymentDiagnosticsDefinition(Azure.ResourceManager.Resources.Deployments.Models.Level level = default(Azure.ResourceManager.Resources.Deployments.Models.Level), string code = null, string message = null, string target = null, System.Collections.Generic.IEnumerable additionalInfo = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity DeploymentIdentity(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType identityType = default(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType), System.Collections.Generic.IDictionary userAssignedIdentities = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ErrorAdditionalInfo ErrorAdditionalInfo(string errorAdditionalInfoType = null, System.BinaryData info = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended ErrorDeploymentExtended(string provisioningState = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? deploymentType = default(Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType?), string deploymentName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.Provider Provider(string id = null, string @namespace = null, string registrationState = null, string registrationPolicy = null, System.Collections.Generic.IEnumerable resourceTypes = null, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState? providerAuthorizationConsentState = default(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderExtendedLocation ProviderExtendedLocation(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string providerExtendedLocationType = null, System.Collections.Generic.IEnumerable extendedLocations = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderResourceType ProviderResourceType(string resourceType = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable locationMappings = null, System.Collections.Generic.IEnumerable aliases = null, System.Collections.Generic.IEnumerable apiVersions = null, string defaultApiVersion = null, System.Collections.Generic.IEnumerable zoneMappings = null, System.Collections.Generic.IEnumerable apiProfiles = null, string capabilities = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAlias ResourceTypeAlias(string name = null, System.Collections.Generic.IEnumerable paths = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType? aliasType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType?), string defaultPath = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern defaultPattern = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata defaultMetadata = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPath ResourceTypeAliasPath(string path = null, System.Collections.Generic.IEnumerable apiVersions = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern pattern = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata metadata = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata ResourceTypeAliasPathMetadata(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType? tokenType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType?), Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute? attributes = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern ResourceTypeAliasPattern(string phrase = null, string variable = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType? patternType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.StatusMessage StatusMessage(string status = null, Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.TargetResource TargetResource(string id = null, string resourceName = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, System.BinaryData identifiers = null, string apiVersion = null, string symbolicName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.TemplateHashResult TemplateHashResult(string minifiedTemplate = null, string templateHash = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfChange WhatIfChange(string resourceId = null, string deploymentId = null, string symbolicName = null, System.BinaryData identifiers = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType changeType = Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType.Create, string unsupportedReason = null, System.BinaryData before = null, System.BinaryData after = null, System.Collections.Generic.IEnumerable delta = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfOperationResult WhatIfOperationResult(string status = null, Azure.ResponseError error = null, System.Collections.Generic.IEnumerable changes = null, System.Collections.Generic.IEnumerable potentialChanges = null, System.Collections.Generic.IEnumerable diagnostics = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChange WhatIfPropertyChange(string path = null, Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType propertyChangeType = Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType.Create, System.BinaryData before = null, System.BinaryData after = null, System.Collections.Generic.IEnumerable children = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ZoneMapping ZoneMapping(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable zones = null) { throw null; } + } + public partial class BasicArmDependency : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal BasicArmDependency() { } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.BasicArmDependency 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.Resources.Deployments.Models.BasicArmDependency 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 DeploymentDiagnosticsDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeploymentDiagnosticsDefinition() { } + public System.Collections.Generic.IReadOnlyList AdditionalInfo { get { throw null; } } + public string Code { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.Level Level { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.DeploymentDiagnosticsDefinition 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.Resources.Deployments.Models.DeploymentDiagnosticsDefinition 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 DeploymentIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeploymentIdentity(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType identityType) { } + public Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType IdentityType { get { throw null; } } + 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.Resources.Deployments.Models.DeploymentIdentity 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.Resources.Deployments.Models.DeploymentIdentity 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 DeploymentIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeploymentIdentityType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType None { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType UserAssigned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType 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.Resources.Deployments.Models.DeploymentIdentityType left, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType left, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ErrorAdditionalInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ErrorAdditionalInfo() { } + public string ErrorAdditionalInfoType { get { throw null; } } + public System.BinaryData Info { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorAdditionalInfo 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.Resources.Deployments.Models.ErrorAdditionalInfo 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 ErrorDeployment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDeployment() { } + public string DeploymentName { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? DeploymentType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment 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.Resources.Deployments.Models.ErrorDeployment 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 ErrorDeploymentExtended : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ErrorDeploymentExtended() { } + public string DeploymentName { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? DeploymentType { get { throw null; } } + public string ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended 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.Resources.Deployments.Models.ErrorDeploymentExtended 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 ErrorDeploymentType + { + LastSuccessful = 0, + SpecificDeployment = 1, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExpressionEvaluationScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExpressionEvaluationScope(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope Inner { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope Outer { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope 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.Resources.Deployments.Models.ExpressionEvaluationScope left, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope left, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExtensionConfigPropertyType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExtensionConfigPropertyType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Array { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Bool { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Int { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Object { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType SecureObject { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType SecureString { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType String { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType 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.Resources.Deployments.Models.ExtensionConfigPropertyType left, Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType left, Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class KeyVaultParameterReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultParameterReference(Azure.ResourceManager.Resources.Models.WritableSubResource keyVault, string secretName) { } + public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } + public string SecretName { get { throw null; } set { } } + public string SecretVersion { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference 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.Resources.Deployments.Models.KeyVaultParameterReference 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 Level : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Level(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Error { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Info { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.Level 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.Resources.Deployments.Models.Level left, Azure.ResourceManager.Resources.Deployments.Models.Level right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.Level (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.Level left, Azure.ResourceManager.Resources.Deployments.Models.Level right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Provider : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal Provider() { } + public string Id { get { throw null; } } + public string Namespace { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState? ProviderAuthorizationConsentState { get { throw null; } } + public string RegistrationPolicy { get { throw null; } } + public string RegistrationState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ResourceTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.Provider 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.Resources.Deployments.Models.Provider 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 ProviderAuthorizationConsentState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProviderAuthorizationConsentState(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState Consented { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState NotRequired { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState Required { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState 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.Resources.Deployments.Models.ProviderAuthorizationConsentState left, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState left, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProviderExtendedLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProviderExtendedLocation() { } + public System.Collections.Generic.IReadOnlyList ExtendedLocations { get { throw null; } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string ProviderExtendedLocationType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ProviderExtendedLocation 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.Resources.Deployments.Models.ProviderExtendedLocation 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 ProviderResourceType : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProviderResourceType() { } + public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ApiProfiles { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public string Capabilities { get { throw null; } } + public string DefaultApiVersion { get { throw null; } } + public System.Collections.Generic.IReadOnlyList LocationMappings { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Locations { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } + public string ResourceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ZoneMappings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ProviderResourceType 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.Resources.Deployments.Models.ProviderResourceType 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 ProvisioningOperationKind + { + NotSpecified = 0, + Create = 1, + Delete = 2, + Waiting = 3, + AzureAsyncOperationWaiting = 4, + ResourceCacheWaiting = 5, + Action = 6, + Read = 7, + EvaluateDeploymentOutput = 8, + DeploymentCleanup = 9, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourcesProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourcesProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Created { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Ready { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Running { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState 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.Resources.Deployments.Models.ResourcesProvisioningState left, Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState left, Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAlias : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAlias() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType? AliasType { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata DefaultMetadata { get { throw null; } } + public string DefaultPath { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern DefaultPattern { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Paths { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAlias 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.Resources.Deployments.Models.ResourceTypeAlias 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 ResourceTypeAliasPath : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPath() { } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata Metadata { get { throw null; } } + public string Path { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern Pattern { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPath 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.Resources.Deployments.Models.ResourceTypeAliasPath 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 ResourceTypeAliasPathAttribute : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceTypeAliasPathAttribute(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute Modifiable { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute None { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute 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.Resources.Deployments.Models.ResourceTypeAliasPathAttribute left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAliasPathMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPathMetadata() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute? Attributes { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType? TokenType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata 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.Resources.Deployments.Models.ResourceTypeAliasPathMetadata 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 ResourceTypeAliasPathTokenType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceTypeAliasPathTokenType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Any { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Array { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Boolean { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Integer { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Number { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Object { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType String { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType 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.Resources.Deployments.Models.ResourceTypeAliasPathTokenType left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAliasPattern : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPattern() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType? PatternType { get { throw null; } } + public string Phrase { get { throw null; } } + public string Variable { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern 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.Resources.Deployments.Models.ResourceTypeAliasPattern 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 ResourceTypeAliasPatternType + { + NotSpecified = 0, + Extract = 1, + } + public enum ResourceTypeAliasType + { + NotSpecified = 0, + PlainText = 1, + Mask = 2, + } + public partial class StatusMessage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal StatusMessage() { } + public Azure.ResponseError Error { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.StatusMessage 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.Resources.Deployments.Models.StatusMessage 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 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetResource() { } + public string ApiVersion { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public string Id { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + public string SymbolicName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.TargetResource 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.Resources.Deployments.Models.TargetResource 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 TemplateHashResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemplateHashResult() { } + public string MinifiedTemplate { get { throw null; } } + public string TemplateHash { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.TemplateHashResult 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.Resources.Deployments.Models.TemplateHashResult 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 ValidationLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ValidationLevel(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel Provider { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel ProviderNoRbac { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel Template { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel 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.Resources.Deployments.Models.ValidationLevel left, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel left, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WhatIfChange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfChange() { } + public System.BinaryData After { get { throw null; } } + public System.BinaryData Before { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType ChangeType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Delta { get { throw null; } } + public string DeploymentId { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceId { get { throw null; } } + public string SymbolicName { get { throw null; } } + public string UnsupportedReason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfChange 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.Resources.Deployments.Models.WhatIfChange 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 WhatIfChangeType + { + Create = 0, + Delete = 1, + Ignore = 2, + Deploy = 3, + NoChange = 4, + Modify = 5, + Unsupported = 6, + } + public partial class WhatIfOperationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfOperationResult() { } + public System.Collections.Generic.IReadOnlyList Changes { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Diagnostics { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PotentialChanges { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfOperationResult 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.Resources.Deployments.Models.WhatIfOperationResult 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 WhatIfPropertyChange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfPropertyChange() { } + public System.BinaryData After { get { throw null; } } + public System.BinaryData Before { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Children { get { throw null; } } + public string Path { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType PropertyChangeType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChange 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.Resources.Deployments.Models.WhatIfPropertyChange 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 WhatIfPropertyChangeType + { + Create = 0, + Delete = 1, + Modify = 2, + Array = 3, + NoEffect = 4, + } + public enum WhatIfResultFormat + { + ResourceIdOnly = 0, + FullResourcePayloads = 1, + } + public partial class ZoneMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ZoneMapping() { } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Zones { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ZoneMapping 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.Resources.Deployments.Models.ZoneMapping 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/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.netstandard2.0.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.netstandard2.0.cs new file mode 100644 index 000000000000..b903f92a49fa --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/api/Azure.ResourceManager.Resources.Deployments.netstandard2.0.cs @@ -0,0 +1,985 @@ +namespace Azure.ResourceManager.Resources.Deployments +{ + public partial class ArmDeploymentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ArmDeploymentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string deploymentName, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string deploymentName, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string deploymentName, 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 ArmDeploymentData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentData() { } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended Properties { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Tags { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.ArmDeploymentData 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 ArmDeploymentResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ArmDeploymentResource() { } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentData 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 virtual Azure.Response Cancel(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckExistence(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CheckExistenceAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string scope, string deploymentName) { 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 ExportTemplate(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExportTemplateAsync(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 GetDeploymentOperation(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDeploymentOperationAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDeploymentOperations(int? top = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDeploymentOperationsAsync(int? top = default(int?), 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.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.ArmDeploymentData 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.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Validate(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ValidateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation WhatIf(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> WhatIfAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent content, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AzureResourceManagerResourcesDeploymentsContext : System.ClientModel.Primitives.ModelReaderWriterContext + { + internal AzureResourceManagerResourcesDeploymentsContext() { } + public static Azure.ResourceManager.Resources.Deployments.AzureResourceManagerResourcesDeploymentsContext Default { get { throw null; } } + protected override bool TryGetTypeBuilderCore(System.Type type, out System.ClientModel.Primitives.ModelReaderWriterTypeBuilder builder) { throw null; } + } + public static partial class ResourcesDeploymentsExtensions + { + public static Azure.Response CalculateDeploymentTemplateHash(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> CalculateDeploymentTemplateHashAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetArmDeployment(this Azure.ResourceManager.Resources.TenantResource tenantResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetArmDeploymentAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentResource GetArmDeploymentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.ManagementGroups.ManagementGroupResource managementGroupResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments(this Azure.ResourceManager.Resources.TenantResource tenantResource) { throw null; } + } +} +namespace Azure.ResourceManager.Resources.Deployments.Mocking +{ + public partial class MockableResourcesDeploymentsArmClient : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsArmClient() { } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentResource GetArmDeploymentResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableResourcesDeploymentsManagementGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsManagementGroupResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsResourceGroupResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsSubscriptionResource() { } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } + public partial class MockableResourcesDeploymentsTenantResource : Azure.ResourceManager.ArmResource + { + protected MockableResourcesDeploymentsTenantResource() { } + public virtual Azure.Response CalculateDeploymentTemplateHash(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CalculateDeploymentTemplateHashAsync(System.BinaryData template, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetArmDeployment(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetArmDeploymentAsync(string deploymentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Resources.Deployments.ArmDeploymentCollection GetArmDeployments() { throw null; } + } +} +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ApiProfile : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ApiProfile() { } + public string ApiVersion { get { throw null; } } + public string ProfileVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ApiProfile 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.Resources.Deployments.Models.ApiProfile 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 ArmDependency : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDependency() { } + public System.Collections.Generic.IReadOnlyList DependsOn { get { throw null; } } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDependency 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.Resources.Deployments.Models.ArmDependency 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 ArmDeploymentContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentContent(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties properties) { } + public Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity Identity { get { throw null; } set { } } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties Properties { get { throw null; } } + 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.Resources.Deployments.Models.ArmDeploymentContent 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.Resources.Deployments.Models.ArmDeploymentContent 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 ArmDeploymentExportResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentExportResult() { } + public System.BinaryData Template { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExportResult 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.Resources.Deployments.Models.ArmDeploymentExportResult 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 ArmDeploymentExtensionConfigItem : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExtensionConfigItem() { } + public Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType? ExtensionConfigPropertyType { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference KeyVaultReference { get { throw null; } set { } } + public System.BinaryData Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem 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.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem 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 ArmDeploymentExtensionDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentExtensionDefinition() { } + public string Alias { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Config { get { throw null; } } + public string ConfigId { get { throw null; } } + public string Name { 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.Resources.Deployments.Models.ArmDeploymentExtensionDefinition 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.Resources.Deployments.Models.ArmDeploymentExtensionDefinition 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 ArmDeploymentExternalInput : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExternalInput(System.BinaryData value) { } + public System.BinaryData Value { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInput 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.Resources.Deployments.Models.ArmDeploymentExternalInput 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 ArmDeploymentExternalInputDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentExternalInputDefinition(string kind) { } + public System.BinaryData Config { get { throw null; } set { } } + public string Kind { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition 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.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition 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 ArmDeploymentMode + { + Incremental = 0, + Complete = 1, + } + public partial class ArmDeploymentOperation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentOperation() { } + public string Id { get { throw null; } } + public string OperationId { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties Properties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperation 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.Resources.Deployments.Models.ArmDeploymentOperation 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 ArmDeploymentOperationProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentOperationProperties() { } + public System.TimeSpan? Duration { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind? ProvisioningOperation { get { throw null; } } + public string ProvisioningState { get { throw null; } } + public System.BinaryData RequestContent { get { throw null; } } + public System.BinaryData ResponseContent { get { throw null; } } + public string ServiceRequestId { get { throw null; } } + public string StatusCode { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.StatusMessage StatusMessage { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.TargetResource TargetResource { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties 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.Resources.Deployments.Models.ArmDeploymentOperationProperties 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 ArmDeploymentParametersLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentParametersLink(System.Uri uri) { } + public string ContentVersion { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink 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.Resources.Deployments.Models.ArmDeploymentParametersLink 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 ArmDeploymentProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentProperties(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode) { } + public string DebugSettingDetailLevel { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment ErrorDeployment { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? ExpressionEvaluationScope { get { throw null; } set { } } + public System.Collections.Generic.IDictionary> ExtensionConfigs { get { throw null; } } + public System.Collections.Generic.IDictionary ExternalInputDefinitions { get { throw null; } } + public System.Collections.Generic.IDictionary ExternalInputs { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode Mode { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink ParametersLink { get { throw null; } set { } } + public System.BinaryData Template { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink TemplateLink { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? ValidationLevel { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties 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.Resources.Deployments.Models.ArmDeploymentProperties 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 ArmDeploymentPropertiesExtended : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentPropertiesExtended() { } + public string CorrelationId { get { throw null; } } + public string DebugSettingDetailLevel { get { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] set { } } + public System.Collections.Generic.IReadOnlyList Dependencies { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Diagnostics { get { throw null; } } + public System.TimeSpan? Duration { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended ErrorDeployment { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Extensions { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode? Mode { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutputResourceDetails { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public System.Collections.Generic.IReadOnlyList OutputResources { get { throw null; } } + public System.BinaryData Outputs { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink ParametersLink { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Providers { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState? ProvisioningState { get { throw null; } } + public string TemplateHash { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink TemplateLink { get { throw null; } } + public System.DateTimeOffset? Timestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ValidatedResourceDetails { get { throw null; } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public System.Collections.Generic.IReadOnlyList ValidatedResources { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? ValidationLevel { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended 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.Resources.Deployments.Models.ArmDeploymentPropertiesExtended 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 ArmDeploymentTemplateLink : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentTemplateLink() { } + public string ContentVersion { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public string QueryString { get { throw null; } set { } } + public string RelativePath { get { throw null; } set { } } + public System.Uri Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink 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.Resources.Deployments.Models.ArmDeploymentTemplateLink 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 ArmDeploymentValidateResult : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmDeploymentValidateResult() { } + public Azure.ResponseError Error { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentValidateResult 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.Resources.Deployments.Models.ArmDeploymentValidateResult 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 ArmDeploymentWhatIfContent : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentWhatIfContent(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties properties) { } + public Azure.Core.AzureLocation? Location { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties Properties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent 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.Resources.Deployments.Models.ArmDeploymentWhatIfContent 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 ArmDeploymentWhatIfProperties : Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ArmDeploymentWhatIfProperties(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode) : base (default(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode)) { } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat? WhatIfResultFormat { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties 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.Resources.Deployments.Models.ArmDeploymentWhatIfProperties 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 ArmResourceReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ArmResourceReference() { } + public string ApiVersion { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public Azure.Core.ResourceIdentifier Id { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ArmResourceReference 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.Resources.Deployments.Models.ArmResourceReference 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 ArmResourcesDeploymentsModelFactory + { + public static Azure.ResourceManager.Resources.Deployments.Models.ApiProfile ApiProfile(string profileVersion = null, string apiVersion = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDependency ArmDependency(System.Collections.Generic.IEnumerable dependsOn = null, string id = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string resourceName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentContent ArmDeploymentContent(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties properties = null, System.Collections.Generic.IDictionary tags = null, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity identity = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.ArmDeploymentData ArmDeploymentData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended properties = null, System.Collections.Generic.IReadOnlyDictionary tags = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExportResult ArmDeploymentExportResult(System.BinaryData template = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionConfigItem ArmDeploymentExtensionConfigItem(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType? extensionConfigPropertyType = default(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType?), System.BinaryData value = null, Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference keyVaultReference = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition ArmDeploymentExtensionDefinition(string alias = null, string name = null, string version = null, string configId = null, System.Collections.Generic.IReadOnlyDictionary config = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExternalInputDefinition ArmDeploymentExternalInputDefinition(string kind = null, System.BinaryData config = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperation ArmDeploymentOperation(string id = null, string operationId = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperationProperties ArmDeploymentOperationProperties(Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind? provisioningOperation = default(Azure.ResourceManager.Resources.Deployments.Models.ProvisioningOperationKind?), string provisioningState = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.TimeSpan? duration = default(System.TimeSpan?), string serviceRequestId = null, string statusCode = null, Azure.ResourceManager.Resources.Deployments.Models.StatusMessage statusMessage = null, Azure.ResourceManager.Resources.Deployments.Models.TargetResource targetResource = null, System.BinaryData requestContent = null, System.BinaryData responseContent = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentProperties ArmDeploymentProperties(System.BinaryData template = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, System.Collections.Generic.IDictionary externalInputs = null, System.Collections.Generic.IDictionary externalInputDefinitions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IDictionary> extensionConfigs = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode = Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode.Incremental, string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment errorDeployment = null, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? expressionEvaluationScope = default(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope?), Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended ArmDeploymentPropertiesExtended(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState? provisioningState = default(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState?), string correlationId = null, System.DateTimeOffset? timestamp = default(System.DateTimeOffset?), System.TimeSpan? duration = default(System.TimeSpan?), System.BinaryData outputs = null, System.Collections.Generic.IEnumerable providers = null, System.Collections.Generic.IEnumerable dependencies = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IEnumerable extensions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode? mode = default(Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode?), string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended errorDeployment = null, string templateHash = null, System.Collections.Generic.IEnumerable outputResourceDetails = null, System.Collections.Generic.IEnumerable validatedResourceDetails = null, Azure.ResponseError error = null, System.Collections.Generic.IEnumerable diagnostics = null, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentValidateResult ArmDeploymentValidateResult(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResponseError error = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentPropertiesExtended properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfContent ArmDeploymentWhatIfContent(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentWhatIfProperties ArmDeploymentWhatIfProperties(System.BinaryData template = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentTemplateLink templateLink = null, System.BinaryData parameters = null, System.Collections.Generic.IDictionary externalInputs = null, System.Collections.Generic.IDictionary externalInputDefinitions = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentParametersLink parametersLink = null, System.Collections.Generic.IDictionary> extensionConfigs = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode mode = Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentMode.Incremental, string debugSettingDetailLevel = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment errorDeployment = null, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope? expressionEvaluationScope = default(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope?), Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel? validationLevel = default(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel?), Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat? whatIfResultFormat = default(Azure.ResourceManager.Resources.Deployments.Models.WhatIfResultFormat?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ArmResourceReference ArmResourceReference(Azure.Core.ResourceIdentifier id = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, string resourceType = null, System.BinaryData identifiers = null, string apiVersion = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.BasicArmDependency BasicArmDependency(string id = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), string resourceName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentDiagnosticsDefinition DeploymentDiagnosticsDefinition(Azure.ResourceManager.Resources.Deployments.Models.Level level = default(Azure.ResourceManager.Resources.Deployments.Models.Level), string code = null, string message = null, string target = null, System.Collections.Generic.IEnumerable additionalInfo = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentity DeploymentIdentity(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType identityType = default(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType), System.Collections.Generic.IDictionary userAssignedIdentities = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ErrorAdditionalInfo ErrorAdditionalInfo(string errorAdditionalInfoType = null, System.BinaryData info = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended ErrorDeploymentExtended(string provisioningState = null, Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? deploymentType = default(Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType?), string deploymentName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.Provider Provider(string id = null, string @namespace = null, string registrationState = null, string registrationPolicy = null, System.Collections.Generic.IEnumerable resourceTypes = null, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState? providerAuthorizationConsentState = default(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderExtendedLocation ProviderExtendedLocation(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), string providerExtendedLocationType = null, System.Collections.Generic.IEnumerable extendedLocations = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderResourceType ProviderResourceType(string resourceType = null, System.Collections.Generic.IEnumerable locations = null, System.Collections.Generic.IEnumerable locationMappings = null, System.Collections.Generic.IEnumerable aliases = null, System.Collections.Generic.IEnumerable apiVersions = null, string defaultApiVersion = null, System.Collections.Generic.IEnumerable zoneMappings = null, System.Collections.Generic.IEnumerable apiProfiles = null, string capabilities = null, System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAlias ResourceTypeAlias(string name = null, System.Collections.Generic.IEnumerable paths = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType? aliasType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType?), string defaultPath = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern defaultPattern = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata defaultMetadata = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPath ResourceTypeAliasPath(string path = null, System.Collections.Generic.IEnumerable apiVersions = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern pattern = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata metadata = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata ResourceTypeAliasPathMetadata(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType? tokenType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType?), Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute? attributes = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern ResourceTypeAliasPattern(string phrase = null, string variable = null, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType? patternType = default(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType?)) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.StatusMessage StatusMessage(string status = null, Azure.ResponseError error = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.TargetResource TargetResource(string id = null, string resourceName = null, Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, System.BinaryData identifiers = null, string apiVersion = null, string symbolicName = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.TemplateHashResult TemplateHashResult(string minifiedTemplate = null, string templateHash = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfChange WhatIfChange(string resourceId = null, string deploymentId = null, string symbolicName = null, System.BinaryData identifiers = null, Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition extension = null, Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType changeType = Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType.Create, string unsupportedReason = null, System.BinaryData before = null, System.BinaryData after = null, System.Collections.Generic.IEnumerable delta = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfOperationResult WhatIfOperationResult(string status = null, Azure.ResponseError error = null, System.Collections.Generic.IEnumerable changes = null, System.Collections.Generic.IEnumerable potentialChanges = null, System.Collections.Generic.IEnumerable diagnostics = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChange WhatIfPropertyChange(string path = null, Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType propertyChangeType = Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType.Create, System.BinaryData before = null, System.BinaryData after = null, System.Collections.Generic.IEnumerable children = null) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ZoneMapping ZoneMapping(Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), System.Collections.Generic.IEnumerable zones = null) { throw null; } + } + public partial class BasicArmDependency : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal BasicArmDependency() { } + public string Id { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.BasicArmDependency 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.Resources.Deployments.Models.BasicArmDependency 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 DeploymentDiagnosticsDefinition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DeploymentDiagnosticsDefinition() { } + public System.Collections.Generic.IReadOnlyList AdditionalInfo { get { throw null; } } + public string Code { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.Level Level { get { throw null; } } + public string Message { get { throw null; } } + public string Target { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.DeploymentDiagnosticsDefinition 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.Resources.Deployments.Models.DeploymentDiagnosticsDefinition 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 DeploymentIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DeploymentIdentity(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType identityType) { } + public Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType IdentityType { get { throw null; } } + 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.Resources.Deployments.Models.DeploymentIdentity 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.Resources.Deployments.Models.DeploymentIdentity 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 DeploymentIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeploymentIdentityType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType None { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType UserAssigned { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType 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.Resources.Deployments.Models.DeploymentIdentityType left, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType left, Azure.ResourceManager.Resources.Deployments.Models.DeploymentIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ErrorAdditionalInfo : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ErrorAdditionalInfo() { } + public string ErrorAdditionalInfoType { get { throw null; } } + public System.BinaryData Info { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorAdditionalInfo 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.Resources.Deployments.Models.ErrorAdditionalInfo 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 ErrorDeployment : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDeployment() { } + public string DeploymentName { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? DeploymentType { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorDeployment 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.Resources.Deployments.Models.ErrorDeployment 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 ErrorDeploymentExtended : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ErrorDeploymentExtended() { } + public string DeploymentName { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentType? DeploymentType { get { throw null; } } + public string ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ErrorDeploymentExtended 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.Resources.Deployments.Models.ErrorDeploymentExtended 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 ErrorDeploymentType + { + LastSuccessful = 0, + SpecificDeployment = 1, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExpressionEvaluationScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExpressionEvaluationScope(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope Inner { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope Outer { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope 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.Resources.Deployments.Models.ExpressionEvaluationScope left, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope left, Azure.ResourceManager.Resources.Deployments.Models.ExpressionEvaluationScope right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ExtensionConfigPropertyType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ExtensionConfigPropertyType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Array { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Bool { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Int { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType Object { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType SecureObject { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType SecureString { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType String { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType 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.Resources.Deployments.Models.ExtensionConfigPropertyType left, Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType left, Azure.ResourceManager.Resources.Deployments.Models.ExtensionConfigPropertyType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class KeyVaultParameterReference : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultParameterReference(Azure.ResourceManager.Resources.Models.WritableSubResource keyVault, string secretName) { } + public Azure.Core.ResourceIdentifier KeyVaultId { get { throw null; } set { } } + public string SecretName { get { throw null; } set { } } + public string SecretVersion { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.KeyVaultParameterReference 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.Resources.Deployments.Models.KeyVaultParameterReference 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 Level : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Level(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Error { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Info { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.Level Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.Level 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.Resources.Deployments.Models.Level left, Azure.ResourceManager.Resources.Deployments.Models.Level right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.Level (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.Level left, Azure.ResourceManager.Resources.Deployments.Models.Level right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Provider : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal Provider() { } + public string Id { get { throw null; } } + public string Namespace { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState? ProviderAuthorizationConsentState { get { throw null; } } + public string RegistrationPolicy { get { throw null; } } + public string RegistrationState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ResourceTypes { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.Provider 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.Resources.Deployments.Models.Provider 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 ProviderAuthorizationConsentState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProviderAuthorizationConsentState(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState Consented { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState NotRequired { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState Required { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState 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.Resources.Deployments.Models.ProviderAuthorizationConsentState left, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState left, Azure.ResourceManager.Resources.Deployments.Models.ProviderAuthorizationConsentState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ProviderExtendedLocation : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProviderExtendedLocation() { } + public System.Collections.Generic.IReadOnlyList ExtendedLocations { get { throw null; } } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public string ProviderExtendedLocationType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ProviderExtendedLocation 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.Resources.Deployments.Models.ProviderExtendedLocation 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 ProviderResourceType : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ProviderResourceType() { } + public System.Collections.Generic.IReadOnlyList Aliases { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ApiProfiles { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public string Capabilities { get { throw null; } } + public string DefaultApiVersion { get { throw null; } } + public System.Collections.Generic.IReadOnlyList LocationMappings { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Locations { get { throw null; } } + public System.Collections.Generic.IReadOnlyDictionary Properties { get { throw null; } } + public string ResourceType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ZoneMappings { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ProviderResourceType 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.Resources.Deployments.Models.ProviderResourceType 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 ProvisioningOperationKind + { + NotSpecified = 0, + Create = 1, + Delete = 2, + Waiting = 3, + AzureAsyncOperationWaiting = 4, + ResourceCacheWaiting = 5, + Action = 6, + Read = 7, + EvaluateDeploymentOutput = 8, + DeploymentCleanup = 9, + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourcesProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourcesProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Created { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Ready { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Running { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState 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.Resources.Deployments.Models.ResourcesProvisioningState left, Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState left, Azure.ResourceManager.Resources.Deployments.Models.ResourcesProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAlias : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAlias() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasType? AliasType { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata DefaultMetadata { get { throw null; } } + public string DefaultPath { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern DefaultPattern { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Paths { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAlias 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.Resources.Deployments.Models.ResourceTypeAlias 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 ResourceTypeAliasPath : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPath() { } + public System.Collections.Generic.IReadOnlyList ApiVersions { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata Metadata { get { throw null; } } + public string Path { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern Pattern { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPath 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.Resources.Deployments.Models.ResourceTypeAliasPath 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 ResourceTypeAliasPathAttribute : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceTypeAliasPathAttribute(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute Modifiable { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute None { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute 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.Resources.Deployments.Models.ResourceTypeAliasPathAttribute left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAliasPathMetadata : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPathMetadata() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathAttribute? Attributes { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType? TokenType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathMetadata 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.Resources.Deployments.Models.ResourceTypeAliasPathMetadata 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 ResourceTypeAliasPathTokenType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceTypeAliasPathTokenType(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Any { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Array { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Boolean { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Integer { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Number { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType Object { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType String { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType 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.Resources.Deployments.Models.ResourceTypeAliasPathTokenType left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType left, Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPathTokenType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ResourceTypeAliasPattern : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ResourceTypeAliasPattern() { } + public Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPatternType? PatternType { get { throw null; } } + public string Phrase { get { throw null; } } + public string Variable { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ResourceTypeAliasPattern 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.Resources.Deployments.Models.ResourceTypeAliasPattern 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 ResourceTypeAliasPatternType + { + NotSpecified = 0, + Extract = 1, + } + public enum ResourceTypeAliasType + { + NotSpecified = 0, + PlainText = 1, + Mask = 2, + } + public partial class StatusMessage : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal StatusMessage() { } + public Azure.ResponseError Error { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.StatusMessage 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.Resources.Deployments.Models.StatusMessage 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 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TargetResource() { } + public string ApiVersion { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public string Id { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceName { get { throw null; } } + public Azure.Core.ResourceType? ResourceType { get { throw null; } } + public string SymbolicName { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.TargetResource 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.Resources.Deployments.Models.TargetResource 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 TemplateHashResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal TemplateHashResult() { } + public string MinifiedTemplate { get { throw null; } } + public string TemplateHash { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.TemplateHashResult 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.Resources.Deployments.Models.TemplateHashResult 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 ValidationLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ValidationLevel(string value) { throw null; } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel Provider { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel ProviderNoRbac { get { throw null; } } + public static Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel Template { get { throw null; } } + public bool Equals(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel 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.Resources.Deployments.Models.ValidationLevel left, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel left, Azure.ResourceManager.Resources.Deployments.Models.ValidationLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class WhatIfChange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfChange() { } + public System.BinaryData After { get { throw null; } } + public System.BinaryData Before { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfChangeType ChangeType { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Delta { get { throw null; } } + public string DeploymentId { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition Extension { get { throw null; } } + public System.BinaryData Identifiers { get { throw null; } } + public string ResourceId { get { throw null; } } + public string SymbolicName { get { throw null; } } + public string UnsupportedReason { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfChange 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.Resources.Deployments.Models.WhatIfChange 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 WhatIfChangeType + { + Create = 0, + Delete = 1, + Ignore = 2, + Deploy = 3, + NoChange = 4, + Modify = 5, + Unsupported = 6, + } + public partial class WhatIfOperationResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfOperationResult() { } + public System.Collections.Generic.IReadOnlyList Changes { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Diagnostics { get { throw null; } } + public Azure.ResponseError Error { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PotentialChanges { get { throw null; } } + public string Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfOperationResult 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.Resources.Deployments.Models.WhatIfOperationResult 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 WhatIfPropertyChange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal WhatIfPropertyChange() { } + public System.BinaryData After { get { throw null; } } + public System.BinaryData Before { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Children { get { throw null; } } + public string Path { get { throw null; } } + public Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChangeType PropertyChangeType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.WhatIfPropertyChange 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.Resources.Deployments.Models.WhatIfPropertyChange 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 WhatIfPropertyChangeType + { + Create = 0, + Delete = 1, + Modify = 2, + Array = 3, + NoEffect = 4, + } + public enum WhatIfResultFormat + { + ResourceIdOnly = 0, + FullResourcePayloads = 1, + } + public partial class ZoneMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ZoneMapping() { } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Zones { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Resources.Deployments.Models.ZoneMapping 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.Resources.Deployments.Models.ZoneMapping 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/resources/Azure.ResourceManager.Resources.Deployments/assets.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/assets.json new file mode 100644 index 000000000000..73964f90f6cc --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/resources.deployments/Azure.ResourceManager.Resources.Deployments", + "Tag": "" +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/samples/Azure.ResourceManager.Resources.Deployments.Samples.csproj b/sdk/resources/Azure.ResourceManager.Resources.Deployments/samples/Azure.ResourceManager.Resources.Deployments.Samples.csproj new file mode 100644 index 000000000000..edc286a74085 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/samples/Azure.ResourceManager.Resources.Deployments.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Azure.ResourceManager.Resources.Deployments.csproj b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Azure.ResourceManager.Resources.Deployments.csproj new file mode 100644 index 000000000000..28ab11910c69 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Azure.ResourceManager.Resources.Deployments.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.Resources.Deployments + Azure Resource Manager client SDK for Azure resource provider Resources.Deployments. + azure;management;arm;resource manager;resources.deployments + + diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/ArmDeploymentPropertiesExtended.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/ArmDeploymentPropertiesExtended.cs new file mode 100644 index 000000000000..c5de7550c3cf --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/ArmDeploymentPropertiesExtended.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using System.Collections.Generic; +using System.ComponentModel; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment properties with additional details. + [CodeGenSuppress("DebugSettingDetailLevel")] + public partial class ArmDeploymentPropertiesExtended + { + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + public string DebugSettingDetailLevel + { + get => DebugSetting?.DetailLevel; + [EditorBrowsable(EditorBrowsableState.Never)] + set => DebugSetting.DetailLevel = value; + } + + /// + /// Array of provisioned resources. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [WirePath("outputResources")] + public IReadOnlyList OutputResources + => OutputResourceDetails.Select(d => ResourceManagerModelFactory.SubResource(d.Id != null ? new ResourceIdentifier(d.Id) : null)).ToArray(); + + /// + /// Array of validated resources. + /// + [EditorBrowsable(EditorBrowsableState.Never)] + [WirePath("validatedResources")] + public IReadOnlyList ValidatedResources + => ValidatedResourceDetails.Select(d => ResourceManagerModelFactory.SubResource(d.Id != null ? new ResourceIdentifier(d.Id) : null)).ToArray(); + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/SubResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/SubResource.cs new file mode 100644 index 000000000000..325e7873e1c2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Custom/Model/SubResource.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +#nullable disable + +using Azure.Core; + +// the generator will generate a SubResource class in the Azure.ResourceManager.Resources.Models +// but since we already have that in the resourcemanager package in the same namespace +// to avoid the compile error, we need this attribute to remove it +[assembly: CodeGenSuppressType("SubResource")] + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentCollection.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentCollection.cs new file mode 100644 index 000000000000..29d377e01c4e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentCollection.cs @@ -0,0 +1,489 @@ +// 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.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of , , or . + /// To get an instance call the GetArmDeployments method from an instance of , , or . + /// + public partial class ArmDeploymentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _armDeploymentDeploymentsClientDiagnostics; + private readonly DeploymentsRestOperations _armDeploymentDeploymentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ArmDeploymentCollection() + { + } + + /// 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 ArmDeploymentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _armDeploymentDeploymentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Resources.Deployments", ArmDeploymentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ArmDeploymentResource.ResourceType, out string armDeploymentDeploymentsApiVersion); + _armDeploymentDeploymentsRestClient = new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, armDeploymentDeploymentsApiVersion); + } + + /// + /// You can provide the template and parameters directly in the request or link to JSON files. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CreateOrUpdateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// 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 deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.CreateOrUpdateAtScopeAsync(Id, deploymentName, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new ArmDeploymentOperationSource(Client), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id, deploymentName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// You can provide the template and parameters directly in the request or link to JSON files. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CreateOrUpdateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// 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 deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.CreateOrUpdateAtScope(Id, deploymentName, content, cancellationToken); + var operation = new DeploymentsArmOperation(new ArmDeploymentOperationSource(Client), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id, deploymentName, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.Get"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id, deploymentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.Get"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.GetAtScope(Id, deploymentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get all the deployments at the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments + /// + /// + /// Operation Id + /// Deployments_ListAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => _armDeploymentDeploymentsRestClient.CreateListAtScopeRequest(Id, filter, top); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _armDeploymentDeploymentsRestClient.CreateListAtScopeNextPageRequest(nextLink, Id, filter, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentResource(Client, ArmDeploymentData.DeserializeArmDeploymentData(e)), _armDeploymentDeploymentsClientDiagnostics, Pipeline, "ArmDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get all the deployments at the given scope. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments + /// + /// + /// Operation Id + /// Deployments_ListAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => _armDeploymentDeploymentsRestClient.CreateListAtScopeRequest(Id, filter, top); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _armDeploymentDeploymentsRestClient.CreateListAtScopeNextPageRequest(nextLink, Id, filter, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ArmDeploymentResource(Client, ArmDeploymentData.DeserializeArmDeploymentData(e)), _armDeploymentDeploymentsClientDiagnostics, Pipeline, "ArmDeploymentCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.Exists"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id, deploymentName, 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.Exists"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.GetAtScope(Id, deploymentName, 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id, deploymentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.GetAtScope(Id, deploymentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.Serialization.cs new file mode 100644 index 000000000000..73505397db11 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.Serialization.cs @@ -0,0 +1,337 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + public partial class ArmDeploymentData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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(); + } + } + + ArmDeploymentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentData(document.RootElement, options); + } + + internal static ArmDeploymentData DeserializeArmDeploymentData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + ArmDeploymentPropertiesExtended properties = default; + IReadOnlyDictionary tags = 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("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArmDeploymentPropertiesExtended.DeserializeArmDeploymentPropertiesExtended(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("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 ArmDeploymentData( + id, + name, + type, + systemData, + location, + properties, + tags ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentData)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.cs new file mode 100644 index 000000000000..15ec88624c01 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentData.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.Models; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + /// + /// A class representing the ArmDeployment data model. + /// Deployment information. + /// + public partial class ArmDeploymentData : 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 ArmDeploymentData() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// the location of the deployment. + /// Deployment properties. + /// Deployment tags. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ArmDeploymentPropertiesExtended properties, IReadOnlyDictionary tags, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Location = location; + Properties = properties; + Tags = tags; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// the location of the deployment. + [WirePath("location")] + public AzureLocation? Location { get; } + /// Deployment properties. + [WirePath("properties")] + public ArmDeploymentPropertiesExtended Properties { get; } + /// Deployment tags. + [WirePath("tags")] + public IReadOnlyDictionary Tags { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.Serialization.cs new file mode 100644 index 000000000000..1987445107aa --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.Serialization.cs @@ -0,0 +1,29 @@ +// 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.Resources.Deployments +{ + public partial class ArmDeploymentResource : IJsonModel + { + private static ArmDeploymentData s_dataDeserializationInstance; + private static ArmDeploymentData DataDeserializationInstance => s_dataDeserializationInstance ??= new(); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ArmDeploymentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)DataDeserializationInstance).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options, AzureResourceManagerResourcesDeploymentsContext.Default); + + ArmDeploymentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options, AzureResourceManagerResourcesDeploymentsContext.Default); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)DataDeserializationInstance).GetFormatFromOptions(options); + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.cs new file mode 100644 index 000000000000..255726974fc4 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmDeploymentResource.cs @@ -0,0 +1,1413 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ManagementGroups; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + /// + /// A Class representing an ArmDeployment 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 GetArmDeploymentResource method. + /// Otherwise you can get one from its parent resource , , or using the GetArmDeployment method. + /// + public partial class ArmDeploymentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The scope. + /// The deploymentName. + public static ResourceIdentifier CreateResourceIdentifier(string scope, string deploymentName) + { + var resourceId = $"{scope}/providers/Microsoft.Resources/deployments/{deploymentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _armDeploymentDeploymentsClientDiagnostics; + private readonly DeploymentsRestOperations _armDeploymentDeploymentsRestClient; + private readonly ClientDiagnostics _deploymentOperationsClientDiagnostics; + private readonly DeploymentRestOperations _deploymentOperationsRestClient; + private readonly ArmDeploymentData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Resources/deployments"; + + /// Initializes a new instance of the class for mocking. + protected ArmDeploymentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ArmDeploymentResource(ArmClient client, ArmDeploymentData 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 ArmDeploymentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _armDeploymentDeploymentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Resources.Deployments", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string armDeploymentDeploymentsApiVersion); + _armDeploymentDeploymentsRestClient = new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, armDeploymentDeploymentsApiVersion); + _deploymentOperationsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Resources.Deployments", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _deploymentOperationsRestClient = new DeploymentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ArmDeploymentData 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 deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Get"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Get"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.GetAtScope(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ArmDeploymentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_DeleteAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Delete"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.DeleteAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(_armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateDeleteAtScopeRequest(Id.Parent, 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; + } + } + + /// + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_DeleteAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Delete"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.DeleteAtScope(Id.Parent, Id.Name, cancellationToken); + var operation = new DeploymentsArmOperation(_armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateDeleteAtScopeRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// You can provide the template and parameters directly in the request or link to JSON files. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CreateOrUpdateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Update"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.CreateOrUpdateAtScopeAsync(Id.Parent, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new ArmDeploymentOperationSource(Client), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id.Parent, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// You can provide the template and parameters directly in the request or link to JSON files. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CreateOrUpdateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Update"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.CreateOrUpdateAtScope(Id.Parent, Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new ArmDeploymentOperationSource(Client), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateCreateOrUpdateAtScopeRequest(Id.Parent, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel + /// + /// + /// Operation Id + /// Deployments_CancelAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task CancelAsync(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Cancel"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.CancelAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel + /// + /// + /// Operation Id + /// Deployments_CancelAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Cancel(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Cancel"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.CancelAtScope(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate + /// + /// + /// Operation Id + /// Deployments_ValidateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to validate. + /// The cancellation token to use. + /// is null. + public virtual async Task> ValidateAsync(WaitUntil waitUntil, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Validate"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.ValidateAtScopeAsync(Id.Parent, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new ArmDeploymentValidateResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateValidateAtScopeRequest(Id.Parent, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate + /// + /// + /// Operation Id + /// Deployments_ValidateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to validate. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Validate(WaitUntil waitUntil, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.Validate"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.ValidateAtScope(Id.Parent, Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new ArmDeploymentValidateResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateValidateAtScopeRequest(Id.Parent, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Exports the template used for specified deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate + /// + /// + /// Operation Id + /// Deployments_ExportTemplateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> ExportTemplateAsync(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.ExportTemplate"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.ExportTemplateAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Exports the template used for specified deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate + /// + /// + /// Operation Id + /// Deployments_ExportTemplateAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response ExportTemplate(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.ExportTemplate"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.ExportTemplateAtScope(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns changes that will be made by the deployment if executed at the scope of the tenant group. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtTenantScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtManagementGroupScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtSubscriptionScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIf + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to validate. + /// The cancellation token to use. + /// is null. + public virtual async Task> WhatIfAsync(WaitUntil waitUntil, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.WhatIf"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == TenantResource.ResourceType) + { + var response = await _armDeploymentDeploymentsRestClient.WhatIfAtTenantScopeAsync(Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtTenantScopeRequest(Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + else if (Id.Parent.ResourceType == ManagementGroupResource.ResourceType) + { + var response = await _armDeploymentDeploymentsRestClient.WhatIfAtManagementGroupScopeAsync(Id.Parent.Name, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtManagementGroupScopeRequest(Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + else if (Id.Parent.ResourceType == SubscriptionResource.ResourceType) + { + var response = await _armDeploymentDeploymentsRestClient.WhatIfAtSubscriptionScopeAsync(Id.SubscriptionId, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtSubscriptionScopeRequest(Id.SubscriptionId, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + else if (Id.Parent.ResourceType == ResourceGroupResource.ResourceType) + { + var response = await _armDeploymentDeploymentsRestClient.WhatIfAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken).ConfigureAwait(false); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + else + { + throw new InvalidOperationException($"{Id.Parent.ResourceType} is not supported here"); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns changes that will be made by the deployment if executed at the scope of the tenant group. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtTenantScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtManagementGroupScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIfAtSubscriptionScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf + /// + /// + /// Operation Id + /// Deployments_WhatIf + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters to validate. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation WhatIf(WaitUntil waitUntil, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.WhatIf"); + scope.Start(); + try + { + if (Id.Parent.ResourceType == TenantResource.ResourceType) + { + var response = _armDeploymentDeploymentsRestClient.WhatIfAtTenantScope(Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtTenantScopeRequest(Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + else if (Id.Parent.ResourceType == ManagementGroupResource.ResourceType) + { + var response = _armDeploymentDeploymentsRestClient.WhatIfAtManagementGroupScope(Id.Parent.Name, Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtManagementGroupScopeRequest(Id.Parent.Name, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + else if (Id.Parent.ResourceType == SubscriptionResource.ResourceType) + { + var response = _armDeploymentDeploymentsRestClient.WhatIfAtSubscriptionScope(Id.SubscriptionId, Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfAtSubscriptionScopeRequest(Id.SubscriptionId, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + else if (Id.Parent.ResourceType == ResourceGroupResource.ResourceType) + { + var response = _armDeploymentDeploymentsRestClient.WhatIf(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content, cancellationToken); + var operation = new DeploymentsArmOperation(new WhatIfOperationResultOperationSource(), _armDeploymentDeploymentsClientDiagnostics, Pipeline, _armDeploymentDeploymentsRestClient.CreateWhatIfRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, content).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + else + { + throw new InvalidOperationException($"{Id.Parent.ResourceType} is not supported here"); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a deployments operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId} + /// + /// + /// Operation Id + /// DeploymentOperations_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The ID of the operation to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetDeploymentOperationAsync(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _deploymentOperationsClientDiagnostics.CreateScope("ArmDeploymentResource.GetDeploymentOperation"); + scope.Start(); + try + { + var response = await _deploymentOperationsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, operationId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets a deployments operation. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId} + /// + /// + /// Operation Id + /// DeploymentOperations_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The ID of the operation to get. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetDeploymentOperation(string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var scope = _deploymentOperationsClientDiagnostics.CreateScope("ArmDeploymentResource.GetDeploymentOperation"); + scope.Start(); + try + { + var response = _deploymentOperationsRestClient.GetAtScope(Id.Parent, Id.Name, operationId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all deployments operations for a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations + /// + /// + /// Operation Id + /// DeploymentOperations_ListAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The number of results to return. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDeploymentOperationsAsync(int? top = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => _deploymentOperationsRestClient.CreateListAtScopeRequest(Id.Parent, Id.Name, top); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deploymentOperationsRestClient.CreateListAtScopeNextPageRequest(nextLink, Id.Parent, Id.Name, top); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ArmDeploymentOperation.DeserializeArmDeploymentOperation(e), _deploymentOperationsClientDiagnostics, Pipeline, "ArmDeploymentResource.GetDeploymentOperations", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all deployments operations for a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations + /// + /// + /// Operation Id + /// DeploymentOperations_ListAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// + /// The number of results to return. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDeploymentOperations(int? top = null, CancellationToken cancellationToken = default) + { + Core.HttpMessage FirstPageRequest(int? pageSizeHint) => _deploymentOperationsRestClient.CreateListAtScopeRequest(Id.Parent, Id.Name, top); + Core.HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _deploymentOperationsRestClient.CreateListAtScopeNextPageRequest(nextLink, Id.Parent, Id.Name, top); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ArmDeploymentOperation.DeserializeArmDeploymentOperation(e), _deploymentOperationsClientDiagnostics, Pipeline, "ArmDeploymentResource.GetDeploymentOperations", "value", "nextLink", cancellationToken); + } + + /// + /// Checks whether the deployment exists. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CheckExistenceAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task CheckExistenceAsync(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.CheckExistence"); + scope.Start(); + try + { + var response = await _armDeploymentDeploymentsRestClient.CheckExistenceAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks whether the deployment exists. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_CheckExistenceAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response CheckExistence(CancellationToken cancellationToken = default) + { + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.CheckExistence"); + scope.Start(); + try + { + var response = _armDeploymentDeploymentsRestClient.CheckExistenceAtScope(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 = _armDeploymentDeploymentsRestClient.GetAtScope(Id.Parent, Id.Name, cancellationToken); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 = _armDeploymentDeploymentsRestClient.GetAtScope(Id.Parent, Id.Name, cancellationToken); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 _armDeploymentDeploymentsRestClient.GetAtScopeAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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 + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _armDeploymentDeploymentsClientDiagnostics.CreateScope("ArmDeploymentResource.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 = _armDeploymentDeploymentsRestClient.GetAtScope(Id.Parent, Id.Name, cancellationToken); + return Response.FromValue(new ArmDeploymentResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ArmDeploymentContent(new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)); + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmResourcesDeploymentsModelFactory.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmResourcesDeploymentsModelFactory.cs new file mode 100644 index 000000000000..b050d42b6e1e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ArmResourcesDeploymentsModelFactory.cs @@ -0,0 +1,646 @@ +// 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.Resources.Deployments.Models +{ + /// Model factory for models. + public static partial class ArmResourcesDeploymentsModelFactory + { + /// Initializes a new instance of . + /// The additional info type. + /// The additional info. + /// A new instance for mocking. + public static ErrorAdditionalInfo ErrorAdditionalInfo(string errorAdditionalInfoType = null, BinaryData info = null) + { + return new ErrorAdditionalInfo(errorAdditionalInfoType, info, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The location to store the deployment data. + /// The deployment properties. + /// Deployment tags. + /// The Managed Identity configuration for a deployment. + /// A new instance for mocking. + public static ArmDeploymentContent ArmDeploymentContent(AzureLocation? location = null, ArmDeploymentProperties properties = null, IDictionary tags = null, DeploymentIdentity identity = null) + { + tags ??= new Dictionary(); + + return new ArmDeploymentContent(location, properties, tags, identity, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// External input values, used by external tooling for parameter evaluation. + /// External input definitions, used by external tooling to define expected external input values. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The configurations to use for deployment extensions. The keys of this object are deployment extension aliases as defined in the deployment template. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + /// The validation level of the deployment. + /// A new instance for mocking. + public static ArmDeploymentProperties ArmDeploymentProperties(BinaryData template = null, ArmDeploymentTemplateLink templateLink = null, BinaryData parameters = null, IDictionary externalInputs = null, IDictionary externalInputDefinitions = null, ArmDeploymentParametersLink parametersLink = null, IDictionary> extensionConfigs = null, ArmDeploymentMode mode = default, string debugSettingDetailLevel = null, ErrorDeployment errorDeployment = null, ExpressionEvaluationScope? expressionEvaluationScope = null, ValidationLevel? validationLevel = null) + { + externalInputs ??= new Dictionary(); + externalInputDefinitions ??= new Dictionary(); + extensionConfigs ??= new Dictionary>(); + + return new ArmDeploymentProperties( + template, + templateLink, + parameters, + externalInputs, + externalInputDefinitions, + parametersLink, + extensionConfigs, + mode, + debugSettingDetailLevel != null ? new DebugSetting(debugSettingDetailLevel, serializedAdditionalRawData: null) : null, + errorDeployment, + expressionEvaluationScope != null ? new ExpressionEvaluationOptions(expressionEvaluationScope, serializedAdditionalRawData: null) : null, + validationLevel, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The kind of external input. + /// Configuration for the external input. + /// A new instance for mocking. + public static ArmDeploymentExternalInputDefinition ArmDeploymentExternalInputDefinition(string kind = null, BinaryData config = null) + { + return new ArmDeploymentExternalInputDefinition(kind, config, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The value type of the extension config property. + /// The value of the extension config property. + /// The Azure Key Vault reference used to retrieve the secret value of the extension config property. + /// A new instance for mocking. + public static ArmDeploymentExtensionConfigItem ArmDeploymentExtensionConfigItem(ExtensionConfigPropertyType? extensionConfigPropertyType = null, BinaryData value = null, KeyVaultParameterReference keyVaultReference = null) + { + return new ArmDeploymentExtensionConfigItem(extensionConfigPropertyType, value, keyVaultReference, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The identity type. + /// The set of user assigned identities associated with the resource. + /// A new instance for mocking. + public static DeploymentIdentity DeploymentIdentity(DeploymentIdentityType identityType = default, IDictionary userAssignedIdentities = null) + { + userAssignedIdentities ??= new Dictionary(); + + return new DeploymentIdentity(identityType, userAssignedIdentities, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// the location of the deployment. + /// Deployment properties. + /// Deployment tags. + /// A new instance for mocking. + public static ArmDeploymentData ArmDeploymentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ArmDeploymentPropertiesExtended properties = null, IReadOnlyDictionary tags = null) + { + tags ??= new Dictionary(); + + return new ArmDeploymentData( + id, + name, + resourceType, + systemData, + location, + properties, + tags, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Denotes the state of provisioning. + /// The correlation ID of the deployment. + /// The timestamp of the template deployment. + /// The duration of the template deployment. + /// Key/value pairs that represent deployment output. + /// The list of resource providers needed for the deployment. + /// The list of deployment dependencies. + /// The URI referencing the template. + /// Deployment parameters. + /// The URI referencing the parameters. + /// The extensions used in this deployment. + /// The deployment mode. Possible values are Incremental and Complete. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// The hash produced for the template. + /// Array of provisioned resources. + /// Array of validated resources. + /// The deployment error. + /// Contains diagnostic information collected during validation process. + /// The validation level of the deployment. + /// A new instance for mocking. + public static ArmDeploymentPropertiesExtended ArmDeploymentPropertiesExtended(ResourcesProvisioningState? provisioningState = null, string correlationId = null, DateTimeOffset? timestamp = null, TimeSpan? duration = null, BinaryData outputs = null, IEnumerable providers = null, IEnumerable dependencies = null, ArmDeploymentTemplateLink templateLink = null, BinaryData parameters = null, ArmDeploymentParametersLink parametersLink = null, IEnumerable extensions = null, ArmDeploymentMode? mode = null, string debugSettingDetailLevel = null, ErrorDeploymentExtended errorDeployment = null, string templateHash = null, IEnumerable outputResourceDetails = null, IEnumerable validatedResourceDetails = null, ResponseError error = null, IEnumerable diagnostics = null, ValidationLevel? validationLevel = null) + { + providers ??= new List(); + dependencies ??= new List(); + extensions ??= new List(); + outputResourceDetails ??= new List(); + validatedResourceDetails ??= new List(); + diagnostics ??= new List(); + + return new ArmDeploymentPropertiesExtended( + provisioningState, + correlationId, + timestamp, + duration, + outputs, + providers?.ToList(), + dependencies?.ToList(), + templateLink, + parameters, + parametersLink, + extensions?.ToList(), + mode, + debugSettingDetailLevel != null ? new DebugSetting(debugSettingDetailLevel, serializedAdditionalRawData: null) : null, + errorDeployment, + templateHash, + outputResourceDetails?.ToList(), + validatedResourceDetails?.ToList(), + error, + diagnostics?.ToList(), + validationLevel, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The provider ID. + /// The namespace of the resource provider. + /// The registration state of the resource provider. + /// The registration policy of the resource provider. + /// The collection of provider resource types. + /// The provider authorization consent state. + /// A new instance for mocking. + public static Provider Provider(string id = null, string @namespace = null, string registrationState = null, string registrationPolicy = null, IEnumerable resourceTypes = null, ProviderAuthorizationConsentState? providerAuthorizationConsentState = null) + { + resourceTypes ??= new List(); + + return new Provider( + id, + @namespace, + registrationState, + registrationPolicy, + resourceTypes?.ToList(), + providerAuthorizationConsentState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource type. + /// The collection of locations where this resource type can be created. + /// The location mappings that are supported by this resource type. + /// The aliases that are supported by this resource type. + /// The API version. + /// The default API version. + /// + /// The API profiles for the resource provider. + /// The additional capabilities offered by this resource type. + /// The properties. + /// A new instance for mocking. + public static ProviderResourceType ProviderResourceType(string resourceType = null, IEnumerable locations = null, IEnumerable locationMappings = null, IEnumerable aliases = null, IEnumerable apiVersions = null, string defaultApiVersion = null, IEnumerable zoneMappings = null, IEnumerable apiProfiles = null, string capabilities = null, IReadOnlyDictionary properties = null) + { + locations ??= new List(); + locationMappings ??= new List(); + aliases ??= new List(); + apiVersions ??= new List(); + zoneMappings ??= new List(); + apiProfiles ??= new List(); + properties ??= new Dictionary(); + + return new ProviderResourceType( + resourceType, + locations?.ToList(), + locationMappings?.ToList(), + aliases?.ToList(), + apiVersions?.ToList(), + defaultApiVersion, + zoneMappings?.ToList(), + apiProfiles?.ToList(), + capabilities, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The azure location. + /// The extended location type. + /// The extended locations for the azure location. + /// A new instance for mocking. + public static ProviderExtendedLocation ProviderExtendedLocation(AzureLocation? location = null, string providerExtendedLocationType = null, IEnumerable extendedLocations = null) + { + extendedLocations ??= new List(); + + return new ProviderExtendedLocation(location, providerExtendedLocationType, extendedLocations?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The alias name. + /// The paths for an alias. + /// The type of the alias. + /// The default path for an alias. + /// The default pattern for an alias. + /// The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata. + /// A new instance for mocking. + public static ResourceTypeAlias ResourceTypeAlias(string name = null, IEnumerable paths = null, ResourceTypeAliasType? aliasType = null, string defaultPath = null, ResourceTypeAliasPattern defaultPattern = null, ResourceTypeAliasPathMetadata defaultMetadata = null) + { + paths ??= new List(); + + return new ResourceTypeAlias( + name, + paths?.ToList(), + aliasType, + defaultPath, + defaultPattern, + defaultMetadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The path of an alias. + /// The API versions. + /// The pattern for an alias path. + /// The metadata of the alias path. If missing, fall back to the default metadata of the alias. + /// A new instance for mocking. + public static ResourceTypeAliasPath ResourceTypeAliasPath(string path = null, IEnumerable apiVersions = null, ResourceTypeAliasPattern pattern = null, ResourceTypeAliasPathMetadata metadata = null) + { + apiVersions ??= new List(); + + return new ResourceTypeAliasPath(path, apiVersions?.ToList(), pattern, metadata, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The alias pattern phrase. + /// The alias pattern variable. + /// The type of alias pattern. + /// A new instance for mocking. + public static ResourceTypeAliasPattern ResourceTypeAliasPattern(string phrase = null, string variable = null, ResourceTypeAliasPatternType? patternType = null) + { + return new ResourceTypeAliasPattern(phrase, variable, patternType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of the token that the alias path is referring to. + /// The attributes of the token that the alias path is referring to. + /// A new instance for mocking. + public static ResourceTypeAliasPathMetadata ResourceTypeAliasPathMetadata(ResourceTypeAliasPathTokenType? tokenType = null, ResourceTypeAliasPathAttribute? attributes = null) + { + return new ResourceTypeAliasPathMetadata(tokenType, attributes, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The location of the zone mapping. + /// + /// A new instance for mocking. + public static ZoneMapping ZoneMapping(AzureLocation? location = null, IEnumerable zones = null) + { + zones ??= new List(); + + return new ZoneMapping(location, zones?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The profile version. + /// The API version. + /// A new instance for mocking. + public static ApiProfile ApiProfile(string profileVersion = null, string apiVersion = null) + { + return new ApiProfile(profileVersion, apiVersion, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The list of dependencies. + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + /// A new instance for mocking. + public static ArmDependency ArmDependency(IEnumerable dependsOn = null, string id = null, ResourceType? resourceType = null, string resourceName = null) + { + dependsOn ??= new List(); + + return new ArmDependency(dependsOn?.ToList(), id, resourceType, resourceName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + /// A new instance for mocking. + public static BasicArmDependency BasicArmDependency(string id = null, ResourceType? resourceType = null, string resourceName = null) + { + return new BasicArmDependency(id, resourceType, resourceName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The alias of the extension as defined in the deployment template. + /// The extension name. + /// The extension version. + /// The extension configuration ID. It uniquely identifies a deployment control plane within an extension. + /// The extension configuration. + /// A new instance for mocking. + public static ArmDeploymentExtensionDefinition ArmDeploymentExtensionDefinition(string @alias = null, string name = null, string version = null, string configId = null, IReadOnlyDictionary config = null) + { + config ??= new Dictionary(); + + return new ArmDeploymentExtensionDefinition( + @alias, + name, + version, + configId, + config, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The state of the provisioning for the on error deployment. + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + /// The deployment to be used on error case. + /// A new instance for mocking. + public static ErrorDeploymentExtended ErrorDeploymentExtended(string provisioningState = null, ErrorDeploymentType? deploymentType = null, string deploymentName = null) + { + return new ErrorDeploymentExtended(provisioningState, deploymentType, deploymentName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The fully qualified Azure resource ID. + /// The extension the resource was deployed with. + /// The resource type. + /// The extensible resource identifiers. + /// The API version the resource was deployed with. + /// A new instance for mocking. + public static ArmResourceReference ArmResourceReference(ResourceIdentifier id = null, ArmDeploymentExtensionDefinition extension = null, string resourceType = null, BinaryData identifiers = null, string apiVersion = null) + { + return new ArmResourceReference( + id, + extension, + resourceType, + identifiers, + apiVersion, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Denotes the additional response level. + /// The error code. + /// The error message. + /// The error target. + /// The error additional info. + /// A new instance for mocking. + public static DeploymentDiagnosticsDefinition DeploymentDiagnosticsDefinition(Level level = default, string code = null, string message = null, string target = null, IEnumerable additionalInfo = null) + { + additionalInfo ??= new List(); + + return new DeploymentDiagnosticsDefinition( + level, + code, + message, + target, + additionalInfo?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The deployment validation error. + /// The template deployment properties. + /// A new instance for mocking. + public static ArmDeploymentValidateResult ArmDeploymentValidateResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResponseError error = null, ArmDeploymentPropertiesExtended properties = null) + { + return new ArmDeploymentValidateResult( + id, + name, + resourceType, + systemData, + error, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The template content. + /// A new instance for mocking. + public static ArmDeploymentExportResult ArmDeploymentExportResult(BinaryData template = null) + { + return new ArmDeploymentExportResult(template, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The location to store the deployment data, only required at the tenant and management group scope. + /// The deployment properties. + /// A new instance for mocking. + public static ArmDeploymentWhatIfContent ArmDeploymentWhatIfContent(AzureLocation? location = null, ArmDeploymentWhatIfProperties properties = null) + { + return new ArmDeploymentWhatIfContent(location, properties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// External input values, used by external tooling for parameter evaluation. + /// External input definitions, used by external tooling to define expected external input values. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The configurations to use for deployment extensions. The keys of this object are deployment extension aliases as defined in the deployment template. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + /// The validation level of the deployment. + /// Optional What-If operation settings. + /// A new instance for mocking. + public static ArmDeploymentWhatIfProperties ArmDeploymentWhatIfProperties(BinaryData template = null, ArmDeploymentTemplateLink templateLink = null, BinaryData parameters = null, IDictionary externalInputs = null, IDictionary externalInputDefinitions = null, ArmDeploymentParametersLink parametersLink = null, IDictionary> extensionConfigs = null, ArmDeploymentMode mode = default, string debugSettingDetailLevel = null, ErrorDeployment errorDeployment = null, ExpressionEvaluationScope? expressionEvaluationScope = null, ValidationLevel? validationLevel = null, WhatIfResultFormat? whatIfResultFormat = null) + { + externalInputs ??= new Dictionary(); + externalInputDefinitions ??= new Dictionary(); + extensionConfigs ??= new Dictionary>(); + + return new ArmDeploymentWhatIfProperties( + template, + templateLink, + parameters, + externalInputs, + externalInputDefinitions, + parametersLink, + extensionConfigs, + mode, + debugSettingDetailLevel != null ? new DebugSetting(debugSettingDetailLevel, serializedAdditionalRawData: null) : null, + errorDeployment, + expressionEvaluationScope != null ? new ExpressionEvaluationOptions(expressionEvaluationScope, serializedAdditionalRawData: null) : null, + validationLevel, + serializedAdditionalRawData: null, + whatIfResultFormat != null ? new ArmDeploymentWhatIfSettings(whatIfResultFormat, serializedAdditionalRawData: null) : null); + } + + /// Initializes a new instance of . + /// Status of the What-If operation. + /// Error when What-If operation fails. + /// List of resource changes predicted by What-If operation. + /// List of resource changes predicted by What-If operation. + /// List of resource diagnostics detected by What-If operation. + /// A new instance for mocking. + public static WhatIfOperationResult WhatIfOperationResult(string status = null, ResponseError error = null, IEnumerable changes = null, IEnumerable potentialChanges = null, IEnumerable diagnostics = null) + { + changes ??= new List(); + potentialChanges ??= new List(); + diagnostics ??= new List(); + + return new WhatIfOperationResult( + status, + error, + changes?.ToList(), + potentialChanges?.ToList(), + diagnostics?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource ID. + /// The resource id of the Deployment responsible for this change. + /// The symbolic name of the resource responsible for this change. + /// A subset of properties that uniquely identify a Bicep extensible resource because it lacks a resource id like an Azure resource has. + /// The extension the resource was deployed with. + /// Type of change that will be made to the resource when the deployment is executed. + /// The explanation about why the resource is unsupported by What-If. + /// The snapshot of the resource before the deployment is executed. + /// The predicted snapshot of the resource after the deployment is executed. + /// The predicted changes to resource properties. + /// A new instance for mocking. + public static WhatIfChange WhatIfChange(string resourceId = null, string deploymentId = null, string symbolicName = null, BinaryData identifiers = null, ArmDeploymentExtensionDefinition extension = null, WhatIfChangeType changeType = default, string unsupportedReason = null, BinaryData before = null, BinaryData after = null, IEnumerable delta = null) + { + delta ??= new List(); + + return new WhatIfChange( + resourceId, + deploymentId, + symbolicName, + identifiers, + extension, + changeType, + unsupportedReason, + before, + after, + delta?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The path of the property. + /// The type of property change. + /// The value of the property before the deployment is executed. + /// The value of the property after the deployment is executed. + /// Nested property changes. + /// A new instance for mocking. + public static WhatIfPropertyChange WhatIfPropertyChange(string path = null, WhatIfPropertyChangeType propertyChangeType = default, BinaryData before = null, BinaryData after = null, IEnumerable children = null) + { + children ??= new List(); + + return new WhatIfPropertyChange( + path, + propertyChangeType, + before, + after, + children?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Full deployment operation ID. + /// Deployment operation ID. + /// Deployment properties. + /// A new instance for mocking. + public static ArmDeploymentOperation ArmDeploymentOperation(string id = null, string operationId = null, ArmDeploymentOperationProperties properties = null) + { + return new ArmDeploymentOperation(id, operationId, properties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the current provisioning operation. + /// The state of the provisioning. + /// The date and time of the operation. + /// The duration of the operation. + /// Deployment operation service request id. + /// Operation status code from the resource provider. This property may not be set if a response has not yet been received. + /// Operation status message from the resource provider. This property is optional. It will only be provided if an error was received from the resource provider. + /// The target resource. + /// The HTTP request message. + /// The HTTP response message. + /// A new instance for mocking. + public static ArmDeploymentOperationProperties ArmDeploymentOperationProperties(ProvisioningOperationKind? provisioningOperation = null, string provisioningState = null, DateTimeOffset? timestamp = null, TimeSpan? duration = null, string serviceRequestId = null, string statusCode = null, StatusMessage statusMessage = null, TargetResource targetResource = null, BinaryData requestContent = null, BinaryData responseContent = null) + { + return new ArmDeploymentOperationProperties( + provisioningOperation, + provisioningState, + timestamp, + duration, + serviceRequestId, + statusCode, + statusMessage, + targetResource, + requestContent != null ? new HttpMessage(requestContent, serializedAdditionalRawData: null) : null, + responseContent != null ? new HttpMessage(responseContent, serializedAdditionalRawData: null) : null, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Status of the deployment operation. + /// The error reported by the operation. + /// A new instance for mocking. + public static StatusMessage StatusMessage(string status = null, ResponseError error = null) + { + return new StatusMessage(status, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Azure resource ID of the resource. + /// The name of the resource. + /// The type of the resource. + /// The extension the resource was deployed with. + /// The extensible resource identifiers. + /// The API version the resource was deployed with. + /// The symbolic name of the resource as defined in the deployment template. + /// A new instance for mocking. + public static TargetResource TargetResource(string id = null, string resourceName = null, ResourceType? resourceType = null, ArmDeploymentExtensionDefinition extension = null, BinaryData identifiers = null, string apiVersion = null, string symbolicName = null) + { + return new TargetResource( + id, + resourceName, + resourceType, + extension, + identifiers, + apiVersion, + symbolicName, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The minified template string. + /// The template hash. + /// A new instance for mocking. + public static TemplateHashResult TemplateHashResult(string minifiedTemplate = null, string templateHash = null) + { + return new TemplateHashResult(minifiedTemplate, templateHash, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsArmClient.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsArmClient.cs new file mode 100644 index 000000000000..33cacef1ace2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsArmClient.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.Resources.Deployments.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableResourcesDeploymentsArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesDeploymentsArmClient() + { + } + + /// 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 MockableResourcesDeploymentsArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableResourcesDeploymentsArmClient(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 ArmDeploymentResource GetArmDeploymentResource(ResourceIdentifier id) + { + ArmDeploymentResource.ValidateResourceId(id); + return new ArmDeploymentResource(Client, id); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsManagementGroupResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsManagementGroupResource.cs new file mode 100644 index 000000000000..27c0fc112528 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsManagementGroupResource.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.Resources.Deployments.Mocking +{ + /// A class to add extension methods to ManagementGroupResource. + public partial class MockableResourcesDeploymentsManagementGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesDeploymentsManagementGroupResource() + { + } + + /// 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 MockableResourcesDeploymentsManagementGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsResourceGroupResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsResourceGroupResource.cs new file mode 100644 index 000000000000..92890d09375b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsResourceGroupResource.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.Resources.Deployments.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableResourcesDeploymentsResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesDeploymentsResourceGroupResource() + { + } + + /// 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 MockableResourcesDeploymentsResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the ResourceGroupResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsSubscriptionResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsSubscriptionResource.cs new file mode 100644 index 000000000000..e68186bd4e0e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsSubscriptionResource.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.Resources.Deployments.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableResourcesDeploymentsSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableResourcesDeploymentsSubscriptionResource() + { + } + + /// 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 MockableResourcesDeploymentsSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the SubscriptionResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsTenantResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsTenantResource.cs new file mode 100644 index 000000000000..48429d19ab55 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/MockableResourcesDeploymentsTenantResource.cs @@ -0,0 +1,197 @@ +// 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.Core.Pipeline; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableResourcesDeploymentsTenantResource : ArmResource + { + private ClientDiagnostics _armDeploymentDeploymentsClientDiagnostics; + private DeploymentsRestOperations _armDeploymentDeploymentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableResourcesDeploymentsTenantResource() + { + } + + /// 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 MockableResourcesDeploymentsTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ArmDeploymentDeploymentsClientDiagnostics => _armDeploymentDeploymentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Resources.Deployments", ArmDeploymentResource.ResourceType.Namespace, Diagnostics); + private DeploymentsRestOperations ArmDeploymentDeploymentsRestClient => _armDeploymentDeploymentsRestClient ??= new DeploymentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ArmDeploymentResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ArmDeploymentResources in the TenantResource. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public virtual ArmDeploymentCollection GetArmDeployments() + { + return GetCachedClient(client => new ArmDeploymentCollection(client, Id)); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetArmDeploymentAsync(string deploymentName, CancellationToken cancellationToken = default) + { + return await GetArmDeployments().GetAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the deployment. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetArmDeployment(string deploymentName, CancellationToken cancellationToken = default) + { + return GetArmDeployments().Get(deploymentName, cancellationToken); + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public virtual async Task> CalculateDeploymentTemplateHashAsync(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("MockableResourcesDeploymentsTenantResource.CalculateDeploymentTemplateHash"); + scope.Start(); + try + { + var response = await ArmDeploymentDeploymentsRestClient.CalculateTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public virtual Response CalculateDeploymentTemplateHash(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var scope = ArmDeploymentDeploymentsClientDiagnostics.CreateScope("MockableResourcesDeploymentsTenantResource.CalculateDeploymentTemplateHash"); + scope.Start(); + try + { + var response = ArmDeploymentDeploymentsRestClient.CalculateTemplateHash(template, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/ResourcesDeploymentsExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/ResourcesDeploymentsExtensions.cs new file mode 100644 index 000000000000..fc596441af2a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Extensions/ResourcesDeploymentsExtensions.cs @@ -0,0 +1,509 @@ +// 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.ManagementGroups; +using Azure.ResourceManager.Resources.Deployments.Mocking; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + /// A class to add extension methods to Azure.ResourceManager.Resources.Deployments. + public static partial class ResourcesDeploymentsExtensions + { + private static MockableResourcesDeploymentsArmClient GetMockableResourcesDeploymentsArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableResourcesDeploymentsArmClient(client0)); + } + + private static MockableResourcesDeploymentsManagementGroupResource GetMockableResourcesDeploymentsManagementGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableResourcesDeploymentsManagementGroupResource(client, resource.Id)); + } + + private static MockableResourcesDeploymentsResourceGroupResource GetMockableResourcesDeploymentsResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableResourcesDeploymentsResourceGroupResource(client, resource.Id)); + } + + private static MockableResourcesDeploymentsSubscriptionResource GetMockableResourcesDeploymentsSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableResourcesDeploymentsSubscriptionResource(client, resource.Id)); + } + + private static MockableResourcesDeploymentsTenantResource GetMockableResourcesDeploymentsTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableResourcesDeploymentsTenantResource(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 ArmDeploymentResource GetArmDeploymentResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableResourcesDeploymentsArmClient(client).GetArmDeploymentResource(id); + } + + /// + /// Gets a collection of ArmDeploymentResources in the ManagementGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public static ArmDeploymentCollection GetArmDeployments(this ManagementGroupResource managementGroupResource) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableResourcesDeploymentsManagementGroupResource(managementGroupResource).GetArmDeployments(); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetArmDeploymentAsync(this ManagementGroupResource managementGroupResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return await GetMockableResourcesDeploymentsManagementGroupResource(managementGroupResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetArmDeployment(this ManagementGroupResource managementGroupResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(managementGroupResource, nameof(managementGroupResource)); + + return GetMockableResourcesDeploymentsManagementGroupResource(managementGroupResource).GetArmDeployment(deploymentName, cancellationToken); + } + + /// + /// Gets a collection of ArmDeploymentResources 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 ArmDeploymentResources and their operations over a ArmDeploymentResource. + public static ArmDeploymentCollection GetArmDeployments(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableResourcesDeploymentsResourceGroupResource(resourceGroupResource).GetArmDeployments(); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetArmDeploymentAsync(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableResourcesDeploymentsResourceGroupResource(resourceGroupResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetArmDeployment(this ResourceGroupResource resourceGroupResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableResourcesDeploymentsResourceGroupResource(resourceGroupResource).GetArmDeployment(deploymentName, cancellationToken); + } + + /// + /// Gets a collection of ArmDeploymentResources 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 ArmDeploymentResources and their operations over a ArmDeploymentResource. + public static ArmDeploymentCollection GetArmDeployments(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableResourcesDeploymentsSubscriptionResource(subscriptionResource).GetArmDeployments(); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetArmDeploymentAsync(this SubscriptionResource subscriptionResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableResourcesDeploymentsSubscriptionResource(subscriptionResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetArmDeployment(this SubscriptionResource subscriptionResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableResourcesDeploymentsSubscriptionResource(subscriptionResource).GetArmDeployment(deploymentName, cancellationToken); + } + + /// + /// Gets a collection of ArmDeploymentResources in the TenantResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ArmDeploymentResources and their operations over a ArmDeploymentResource. + public static ArmDeploymentCollection GetArmDeployments(this TenantResource tenantResource) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableResourcesDeploymentsTenantResource(tenantResource).GetArmDeployments(); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetArmDeploymentAsync(this TenantResource tenantResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableResourcesDeploymentsTenantResource(tenantResource).GetArmDeploymentAsync(deploymentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets a deployment. + /// + /// + /// Request Path + /// /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /// + /// + /// Operation Id + /// Deployments_GetAtScope + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetArmDeployment(this TenantResource tenantResource, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableResourcesDeploymentsTenantResource(tenantResource).GetArmDeployment(deploymentName, cancellationToken); + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The template provided to calculate hash. + /// The cancellation token to use. + /// or is null. + public static async Task> CalculateDeploymentTemplateHashAsync(this TenantResource tenantResource, BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return await GetMockableResourcesDeploymentsTenantResource(tenantResource).CalculateDeploymentTemplateHashAsync(template, cancellationToken).ConfigureAwait(false); + } + + /// + /// Calculate the hash of the given template. + /// + /// + /// Request Path + /// /providers/Microsoft.Resources/calculateTemplateHash + /// + /// + /// Operation Id + /// Deployments_CalculateTemplateHash + /// + /// + /// Default Api Version + /// 2025-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The template provided to calculate hash. + /// The cancellation token to use. + /// or is null. + public static Response CalculateDeploymentTemplateHash(this TenantResource tenantResource, BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableResourcesDeploymentsTenantResource(tenantResource).CalculateDeploymentTemplateHash(template, cancellationToken); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Argument.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..9bee0f818a7a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/BicepSerializationHelpers.cs new file mode 100644 index 000000000000..19906a9a93b7 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/BicepSerializationHelpers.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal static class BicepSerializationHelpers + { + public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) + { + string indent = new string(' ', spaces); + int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; + int length = stringBuilder.Length; + bool inMultilineString = false; + + BinaryData data = ModelReaderWriter.Write(childObject, options, AzureResourceManagerResourcesDeploymentsContext.Default); + string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + if (inMultilineString) + { + if (line.Contains("'''")) + { + inMultilineString = false; + } + stringBuilder.AppendLine(line); + continue; + } + if (line.Contains("'''")) + { + inMultilineString = true; + stringBuilder.AppendLine($"{indent}{line}"); + continue; + } + if (i == 0 && !indentFirstLine) + { + stringBuilder.AppendLine($"{line}"); + } + else + { + stringBuilder.AppendLine($"{indent}{line}"); + } + } + if (stringBuilder.Length == length + emptyObjectLength) + { + stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..98b15d4c053d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingList.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..2ed82686d5cd --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..b0eb77252017 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,425 @@ +// Copyright (c) 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.Diagnostics.CodeAnalysis; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + internal static readonly BinaryData SentinelValue = BinaryData.FromBytes("\"__EMPTY__\""u8.ToArray()); + internal static readonly JsonSerializerOptions Options = new JsonSerializerOptions { Converters = { new JsonModelConverter(WireOptions, AzureResourceManagerResourcesDeploymentsContext.Default) } }; + internal static readonly JsonSerializerOptions OptionsUseManagedServiceIdentityV3 = new JsonSerializerOptions { Converters = { new JsonModelConverter(WireOptions, AzureResourceManagerResourcesDeploymentsContext.Default), new ResourceManager.Models.ManagedServiceIdentityTypeV3Converter() } }; + + 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 bool IsSentinelValue(BinaryData value) + { + ReadOnlySpan sentinelSpan = SentinelValue.ToMemory().Span; + ReadOnlySpan valueSpan = value.ToMemory().Span; + return sentinelSpan.SequenceEqual(valueSpan); + } + + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")] + [UnconditionalSuppressMessage("Trimming", "IL3050", Justification = "By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")] + public static T JsonDeserialize(string json, JsonSerializerOptions options) + { + return JsonSerializer.Deserialize(json, options); + } + + [UnconditionalSuppressMessage("Trimming", "IL2026", Justification = "By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")] + [UnconditionalSuppressMessage("Trimming", "IL3050", Justification = "By passing in the JsonSerializerOptions with a reference to AzureResourceManagerCosmosDBContext.Default we are certain there is no AOT compat issue.")] + public static void JsonSerialize(Utf8JsonWriter writer, T data, JsonSerializerOptions options) + { + JsonSerializer.Serialize(writer, data, 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Optional.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..7745c32e7202 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..8d533d518185 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/WirePathAttribute.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/WirePathAttribute.cs new file mode 100644 index 000000000000..580de68dab82 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Internal/WirePathAttribute.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments +{ + [AttributeUsage(AttributeTargets.Property)] + internal class WirePathAttribute : Attribute + { + private string _wirePath; + + public WirePathAttribute(string wirePath) + { + _wirePath = wirePath; + } + + public override string ToString() + { + return _wirePath; + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentOperationSource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentOperationSource.cs new file mode 100644 index 000000000000..054ab6767dfe --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal class ArmDeploymentOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ArmDeploymentOperationSource(ArmClient client) + { + _client = client; + } + + ArmDeploymentResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerResourcesDeploymentsContext.Default); + return new ArmDeploymentResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content, ModelReaderWriterOptions.Json, AzureResourceManagerResourcesDeploymentsContext.Default); + return await Task.FromResult(new ArmDeploymentResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentValidateResultOperationSource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentValidateResultOperationSource.cs new file mode 100644 index 000000000000..8074118be7ad --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/ArmDeploymentValidateResultOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal class ArmDeploymentValidateResultOperationSource : IOperationSource + { + ArmDeploymentValidateResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return ArmDeploymentValidateResult.DeserializeArmDeploymentValidateResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return ArmDeploymentValidateResult.DeserializeArmDeploymentValidateResult(document.RootElement); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperation.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperation.cs new file mode 100644 index 000000000000..b4e24038989c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperation.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.Resources.Deployments +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DeploymentsArmOperation : 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 DeploymentsArmOperation for mocking. + protected DeploymentsArmOperation() + { + } + + internal DeploymentsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DeploymentsArmOperation(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, "DeploymentsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerResourcesDeploymentsContext.Default).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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperationOfT.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperationOfT.cs new file mode 100644 index 000000000000..f4de44e9f56b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/DeploymentsArmOperationOfT.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.Resources.Deployments +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DeploymentsArmOperation : 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 DeploymentsArmOperation for mocking. + protected DeploymentsArmOperation() + { + } + + internal DeploymentsArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal DeploymentsArmOperation(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, "DeploymentsArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json, AzureResourceManagerResourcesDeploymentsContext.Default).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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/WhatIfOperationResultOperationSource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/WhatIfOperationResultOperationSource.cs new file mode 100644 index 000000000000..ad494bc49e3d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/LongRunningOperation/WhatIfOperationResultOperationSource.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal class WhatIfOperationResultOperationSource : IOperationSource + { + WhatIfOperationResult IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + return WhatIfOperationResult.DeserializeWhatIfOperationResult(document.RootElement); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.Serialization.cs new file mode 100644 index 000000000000..6df2ebc738d2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.Serialization.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ApiProfile : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ApiProfile)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProfileVersion)) + { + writer.WritePropertyName("profileVersion"u8); + writer.WriteStringValue(ProfileVersion); + } + if (options.Format != "W" && Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ApiProfile IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ApiProfile)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeApiProfile(document.RootElement, options); + } + + internal static ApiProfile DeserializeApiProfile(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string profileVersion = default; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("profileVersion"u8)) + { + profileVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ApiProfile(profileVersion, apiVersion, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProfileVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" profileVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProfileVersion)) + { + builder.Append(" profileVersion: "); + if (ProfileVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProfileVersion}'''"); + } + else + { + builder.AppendLine($"'{ProfileVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ApiVersion)) + { + builder.Append(" apiVersion: "); + if (ApiVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ApiVersion}'''"); + } + else + { + builder.AppendLine($"'{ApiVersion}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ApiProfile)} does not support writing '{options.Format}' format."); + } + } + + ApiProfile IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeApiProfile(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ApiProfile)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.cs new file mode 100644 index 000000000000..4ad6e5cae218 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ApiProfile.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The ApiProfile. + public partial class ApiProfile + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ApiProfile() + { + } + + /// Initializes a new instance of . + /// The profile version. + /// The API version. + /// Keeps track of any properties unknown to the library. + internal ApiProfile(string profileVersion, string apiVersion, IDictionary serializedAdditionalRawData) + { + ProfileVersion = profileVersion; + ApiVersion = apiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The profile version. + [WirePath("profileVersion")] + public string ProfileVersion { get; } + /// The API version. + [WirePath("apiVersion")] + public string ApiVersion { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.Serialization.cs new file mode 100644 index 000000000000..c2190fd3ee6b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.Serialization.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDependency : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDependency)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(DependsOn)) + { + writer.WritePropertyName("dependsOn"u8); + writer.WriteStartArray(); + foreach (var item in DependsOn) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (Optional.IsDefined(ResourceName)) + { + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDependency IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDependency)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDependency(document.RootElement, options); + } + + internal static ArmDependency DeserializeArmDependency(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList dependsOn = default; + string id = default; + ResourceType? resourceType = default; + string resourceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dependsOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(BasicArmDependency.DeserializeBasicArmDependency(item, options)); + } + dependsOn = array; + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDependency(dependsOn ?? new ChangeTrackingList(), id, resourceType, resourceName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DependsOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dependsOn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DependsOn)) + { + if (DependsOn.Any()) + { + builder.Append(" dependsOn: "); + builder.AppendLine("["); + foreach (var item in DependsOn) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " dependsOn: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + builder.AppendLine($"'{ResourceType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceName)) + { + builder.Append(" resourceName: "); + if (ResourceName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceName}'''"); + } + else + { + builder.AppendLine($"'{ResourceName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDependency)} does not support writing '{options.Format}' format."); + } + } + + ArmDependency IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDependency(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDependency)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.cs new file mode 100644 index 000000000000..b0ad71a6c575 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDependency.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; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment dependency information. + public partial class ArmDependency + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDependency() + { + DependsOn = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of dependencies. + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + /// Keeps track of any properties unknown to the library. + internal ArmDependency(IReadOnlyList dependsOn, string id, ResourceType? resourceType, string resourceName, IDictionary serializedAdditionalRawData) + { + DependsOn = dependsOn; + Id = id; + ResourceType = resourceType; + ResourceName = resourceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of dependencies. + [WirePath("dependsOn")] + public IReadOnlyList DependsOn { get; } + /// The ID of the dependency. + [WirePath("id")] + public string Id { get; } + /// The dependency resource type. + [WirePath("resourceType")] + public ResourceType? ResourceType { get; } + /// The dependency resource name. + [WirePath("resourceName")] + public string ResourceName { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.Serialization.cs new file mode 100644 index 000000000000..4f56e5ec6b5b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.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.Resources.Deployments.Models +{ + public partial class ArmDeploymentContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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(Identity)) + { + writer.WritePropertyName("identity"u8); + writer.WriteObjectValue(Identity, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentContent(document.RootElement, options); + } + + internal static ArmDeploymentContent DeserializeArmDeploymentContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + ArmDeploymentProperties properties = default; + IDictionary tags = default; + DeploymentIdentity identity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + properties = ArmDeploymentProperties.DeserializeArmDeploymentProperties(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("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identity = DeploymentIdentity.DeserializeDeploymentIdentity(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentContent(location, properties, tags ?? new ChangeTrackingDictionary(), 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentContent)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.cs new file mode 100644 index 000000000000..c662e08d1ed1 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentContent.cs @@ -0,0 +1,93 @@ +// 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.Resources.Deployments.Models +{ + /// Deployment operation parameters. + public partial class ArmDeploymentContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 deployment properties. + /// is null. + public ArmDeploymentContent(ArmDeploymentProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The location to store the deployment data. + /// The deployment properties. + /// Deployment tags. + /// The Managed Identity configuration for a deployment. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentContent(AzureLocation? location, ArmDeploymentProperties properties, IDictionary tags, DeploymentIdentity identity, IDictionary serializedAdditionalRawData) + { + Location = location; + Properties = properties; + Tags = tags; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentContent() + { + } + + /// The location to store the deployment data. + [WirePath("location")] + public AzureLocation? Location { get; set; } + /// The deployment properties. + [WirePath("properties")] + public ArmDeploymentProperties Properties { get; } + /// Deployment tags. + [WirePath("tags")] + public IDictionary Tags { get; } + /// The Managed Identity configuration for a deployment. + [WirePath("identity")] + public DeploymentIdentity Identity { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.Serialization.cs new file mode 100644 index 000000000000..b550cc1a7fbd --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentExportResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentExportResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Template)) + { + writer.WritePropertyName("template"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Template); +#else + using (JsonDocument document = JsonDocument.Parse(Template, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentExportResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentExportResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentExportResult(document.RootElement, options); + } + + internal static ArmDeploymentExportResult DeserializeArmDeploymentExportResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData template = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("template"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentExportResult(template, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Template), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" template: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Template)) + { + builder.Append(" template: "); + builder.AppendLine($"'{Template.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentExportResult)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentExportResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentExportResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentExportResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.cs new file mode 100644 index 000000000000..29b254e8b8ea --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExportResult.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; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The deployment export result. + public partial class ArmDeploymentExportResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentExportResult() + { + } + + /// Initializes a new instance of . + /// The template content. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentExportResult(BinaryData template, IDictionary serializedAdditionalRawData) + { + Template = template; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The template content. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("template")] + public BinaryData Template { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.Serialization.cs new file mode 100644 index 000000000000..b4e43496a182 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentExtensionConfigItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentExtensionConfigItem)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ExtensionConfigPropertyType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ExtensionConfigPropertyType.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Value); +#else + using (JsonDocument document = JsonDocument.Parse(Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(KeyVaultReference)) + { + writer.WritePropertyName("keyVaultReference"u8); + writer.WriteObjectValue(KeyVaultReference, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentExtensionConfigItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentExtensionConfigItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentExtensionConfigItem(document.RootElement, options); + } + + internal static ArmDeploymentExtensionConfigItem DeserializeArmDeploymentExtensionConfigItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExtensionConfigPropertyType? type = default; + BinaryData value = default; + KeyVaultParameterReference keyVaultReference = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ExtensionConfigPropertyType(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("keyVaultReference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultReference = KeyVaultParameterReference.DeserializeKeyVaultParameterReference(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentExtensionConfigItem(type, value, keyVaultReference, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExtensionConfigPropertyType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExtensionConfigPropertyType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{ExtensionConfigPropertyType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"'{Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultReference), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keyVaultReference: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KeyVaultReference)) + { + builder.Append(" keyVaultReference: "); + BicepSerializationHelpers.AppendChildObject(builder, KeyVaultReference, options, 2, false, " keyVaultReference: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentExtensionConfigItem)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentExtensionConfigItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentExtensionConfigItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentExtensionConfigItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.cs new file mode 100644 index 000000000000..1a13a6fc6338 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionConfigItem.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The ArmDeploymentExtensionConfigItem. + public partial class ArmDeploymentExtensionConfigItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentExtensionConfigItem() + { + } + + /// Initializes a new instance of . + /// The value type of the extension config property. + /// The value of the extension config property. + /// The Azure Key Vault reference used to retrieve the secret value of the extension config property. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentExtensionConfigItem(ExtensionConfigPropertyType? extensionConfigPropertyType, BinaryData value, KeyVaultParameterReference keyVaultReference, IDictionary serializedAdditionalRawData) + { + ExtensionConfigPropertyType = extensionConfigPropertyType; + Value = value; + KeyVaultReference = keyVaultReference; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The value type of the extension config property. + [WirePath("type")] + public ExtensionConfigPropertyType? ExtensionConfigPropertyType { get; } + /// + /// The value of the extension config property. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("value")] + public BinaryData Value { get; set; } + /// The Azure Key Vault reference used to retrieve the secret value of the extension config property. + [WirePath("keyVaultReference")] + public KeyVaultParameterReference KeyVaultReference { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.Serialization.cs new file mode 100644 index 000000000000..6925bfd9aece --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.Serialization.cs @@ -0,0 +1,329 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentExtensionDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentExtensionDefinition)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Alias)) + { + writer.WritePropertyName("alias"u8); + writer.WriteStringValue(Alias); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && Optional.IsDefined(ConfigId)) + { + writer.WritePropertyName("configId"u8); + writer.WriteStringValue(ConfigId); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Config)) + { + writer.WritePropertyName("config"u8); + writer.WriteStartObject(); + foreach (var item in Config) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentExtensionDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentExtensionDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentExtensionDefinition(document.RootElement, options); + } + + internal static ArmDeploymentExtensionDefinition DeserializeArmDeploymentExtensionDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string @alias = default; + string name = default; + string version = default; + string configId = default; + IReadOnlyDictionary config = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alias"u8)) + { + @alias = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("configId"u8)) + { + configId = property.Value.GetString(); + continue; + } + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ArmDeploymentExtensionConfigItem.DeserializeArmDeploymentExtensionConfigItem(property0.Value, options)); + } + config = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentExtensionDefinition( + @alias, + name, + version, + configId, + config ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Alias), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" alias: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Alias)) + { + builder.Append(" alias: "); + if (Alias.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Alias}'''"); + } + else + { + builder.AppendLine($"'{Alias}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConfigId)) + { + builder.Append(" configId: "); + if (ConfigId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ConfigId}'''"); + } + else + { + builder.AppendLine($"'{ConfigId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Config), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" config: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Config)) + { + if (Config.Any()) + { + builder.Append(" config: "); + builder.AppendLine("{"); + foreach (var item in Config) + { + builder.Append($" '{item.Key}': "); + BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 4, false, " config: "); + } + builder.AppendLine(" }"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentExtensionDefinition)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentExtensionDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentExtensionDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentExtensionDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.cs new file mode 100644 index 000000000000..9e61b457c5ec --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExtensionDefinition.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The ArmDeploymentExtensionDefinition. + public partial class ArmDeploymentExtensionDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentExtensionDefinition() + { + Config = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The alias of the extension as defined in the deployment template. + /// The extension name. + /// The extension version. + /// The extension configuration ID. It uniquely identifies a deployment control plane within an extension. + /// The extension configuration. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentExtensionDefinition(string @alias, string name, string version, string configId, IReadOnlyDictionary config, IDictionary serializedAdditionalRawData) + { + Alias = @alias; + Name = name; + Version = version; + ConfigId = configId; + Config = config; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The alias of the extension as defined in the deployment template. + [WirePath("alias")] + public string Alias { get; } + /// The extension name. + [WirePath("name")] + public string Name { get; } + /// The extension version. + [WirePath("version")] + public string Version { get; } + /// The extension configuration ID. It uniquely identifies a deployment control plane within an extension. + [WirePath("configId")] + public string ConfigId { get; } + /// The extension configuration. + [WirePath("config")] + public IReadOnlyDictionary Config { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.Serialization.cs new file mode 100644 index 000000000000..e225dea81c3c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.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.Resources.Deployments.Models +{ + public partial class ArmDeploymentExternalInput : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentExternalInput)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Value); +#else + using (JsonDocument document = JsonDocument.Parse(Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentExternalInput IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentExternalInput)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentExternalInput(document.RootElement, options); + } + + internal static ArmDeploymentExternalInput DeserializeArmDeploymentExternalInput(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentExternalInput(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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentExternalInput)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentExternalInput IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentExternalInput(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentExternalInput)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.cs new file mode 100644 index 000000000000..d0d0fca70707 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInput.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment external input for parameterization. + public partial class ArmDeploymentExternalInput + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// External input value. + /// is null. + public ArmDeploymentExternalInput(BinaryData value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value; + } + + /// Initializes a new instance of . + /// External input value. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentExternalInput(BinaryData value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentExternalInput() + { + } + + /// + /// External input value. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("value")] + public BinaryData Value { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.Serialization.cs new file mode 100644 index 000000000000..7de4a43c3e04 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.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.Resources.Deployments.Models +{ + public partial class ArmDeploymentExternalInputDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentExternalInputDefinition)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Config); +#else + using (JsonDocument document = JsonDocument.Parse(Config, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentExternalInputDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentExternalInputDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentExternalInputDefinition(document.RootElement, options); + } + + internal static ArmDeploymentExternalInputDefinition DeserializeArmDeploymentExternalInputDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + BinaryData config = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + config = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentExternalInputDefinition(kind, config, 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentExternalInputDefinition)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentExternalInputDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentExternalInputDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentExternalInputDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.cs new file mode 100644 index 000000000000..f214f4b20b60 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentExternalInputDefinition.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment external input definition for parameterization. + public partial class ArmDeploymentExternalInputDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 kind of external input. + /// is null. + public ArmDeploymentExternalInputDefinition(string kind) + { + Argument.AssertNotNull(kind, nameof(kind)); + + Kind = kind; + } + + /// Initializes a new instance of . + /// The kind of external input. + /// Configuration for the external input. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentExternalInputDefinition(string kind, BinaryData config, IDictionary serializedAdditionalRawData) + { + Kind = kind; + Config = config; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentExternalInputDefinition() + { + } + + /// The kind of external input. + [WirePath("kind")] + public string Kind { get; } + /// + /// Configuration for the external input. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("config")] + public BinaryData Config { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.Serialization.cs new file mode 100644 index 000000000000..c080423628cc --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal partial class ArmDeploymentListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentListResult(document.RootElement, options); + } + + internal static ArmDeploymentListResult DeserializeArmDeploymentListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmDeploymentData.DeserializeArmDeploymentData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentListResult)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.cs new file mode 100644 index 000000000000..069b5dea89a2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentListResult.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.Resources.Deployments.Models +{ + /// List of deployments. + internal partial class ArmDeploymentListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// An array of deployments. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// An array of deployments. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.Serialization.cs new file mode 100644 index 000000000000..381b0bc55932 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class ArmDeploymentModeExtensions + { + public static string ToSerialString(this ArmDeploymentMode value) => value switch + { + ArmDeploymentMode.Incremental => "Incremental", + ArmDeploymentMode.Complete => "Complete", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ArmDeploymentMode value.") + }; + + public static ArmDeploymentMode ToArmDeploymentMode(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Incremental")) return ArmDeploymentMode.Incremental; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Complete")) return ArmDeploymentMode.Complete; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ArmDeploymentMode value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.cs new file mode 100644 index 000000000000..1ae471a36ceb --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentMode.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public enum ArmDeploymentMode + { + /// Incremental. + Incremental, + /// Complete. + Complete + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.Serialization.cs new file mode 100644 index 000000000000..635fcac654c5 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentOperation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentOperation)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(OperationId)) + { + writer.WritePropertyName("operationId"u8); + writer.WriteStringValue(OperationId); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentOperation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentOperation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentOperation(document.RootElement, options); + } + + internal static ArmDeploymentOperation DeserializeArmDeploymentOperation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string operationId = default; + ArmDeploymentOperationProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationId"u8)) + { + operationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArmDeploymentOperationProperties.DeserializeArmDeploymentOperationProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentOperation(id, operationId, properties, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OperationId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operationId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OperationId)) + { + builder.Append(" operationId: "); + if (OperationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{OperationId}'''"); + } + else + { + builder.AppendLine($"'{OperationId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperation)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentOperation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentOperation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.cs new file mode 100644 index 000000000000..6d4937d281af --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperation.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.Resources.Deployments.Models +{ + /// Deployment operation information. + public partial class ArmDeploymentOperation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentOperation() + { + } + + /// Initializes a new instance of . + /// Full deployment operation ID. + /// Deployment operation ID. + /// Deployment properties. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentOperation(string id, string operationId, ArmDeploymentOperationProperties properties, IDictionary serializedAdditionalRawData) + { + Id = id; + OperationId = operationId; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Full deployment operation ID. + [WirePath("id")] + public string Id { get; } + /// Deployment operation ID. + [WirePath("operationId")] + public string OperationId { get; } + /// Deployment properties. + [WirePath("properties")] + public ArmDeploymentOperationProperties Properties { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.Serialization.cs new file mode 100644 index 000000000000..c7acaa2bdfa7 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.Serialization.cs @@ -0,0 +1,475 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentOperationProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentOperationProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningOperation)) + { + writer.WritePropertyName("provisioningOperation"u8); + writer.WriteStringValue(ProvisioningOperation.Value.ToSerialString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration.Value, "P"); + } + if (options.Format != "W" && Optional.IsDefined(ServiceRequestId)) + { + writer.WritePropertyName("serviceRequestId"u8); + writer.WriteStringValue(ServiceRequestId); + } + if (options.Format != "W" && Optional.IsDefined(StatusCode)) + { + writer.WritePropertyName("statusCode"u8); + writer.WriteStringValue(StatusCode); + } + if (options.Format != "W" && Optional.IsDefined(StatusMessage)) + { + if (StatusMessage != null) + { + writer.WritePropertyName("statusMessage"u8); + writer.WriteObjectValue(StatusMessage, options); + } + else + { + writer.WriteNull("statusMessage"); + } + } + if (options.Format != "W" && Optional.IsDefined(TargetResource)) + { + writer.WritePropertyName("targetResource"u8); + writer.WriteObjectValue(TargetResource, options); + } + if (options.Format != "W" && Optional.IsDefined(Request)) + { + writer.WritePropertyName("request"u8); + writer.WriteObjectValue(Request, options); + } + if (options.Format != "W" && Optional.IsDefined(Response)) + { + writer.WritePropertyName("response"u8); + writer.WriteObjectValue(Response, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentOperationProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentOperationProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentOperationProperties(document.RootElement, options); + } + + internal static ArmDeploymentOperationProperties DeserializeArmDeploymentOperationProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningOperationKind? provisioningOperation = default; + string provisioningState = default; + DateTimeOffset? timestamp = default; + TimeSpan? duration = default; + string serviceRequestId = default; + string statusCode = default; + StatusMessage statusMessage = default; + TargetResource targetResource = default; + HttpMessage request = default; + HttpMessage response = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningOperation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningOperation = property.Value.GetString().ToProvisioningOperationKind(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("serviceRequestId"u8)) + { + serviceRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("statusCode"u8)) + { + statusCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("statusMessage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + statusMessage = null; + continue; + } + statusMessage = StatusMessage.DeserializeStatusMessage(property.Value, options); + continue; + } + if (property.NameEquals("targetResource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetResource = TargetResource.DeserializeTargetResource(property.Value, options); + continue; + } + if (property.NameEquals("request"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + request = HttpMessage.DeserializeHttpMessage(property.Value, options); + continue; + } + if (property.NameEquals("response"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + response = HttpMessage.DeserializeHttpMessage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentOperationProperties( + provisioningOperation, + provisioningState, + timestamp, + duration, + serviceRequestId, + statusCode, + statusMessage, + targetResource, + request, + response, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningOperation), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningOperation: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningOperation)) + { + builder.Append(" provisioningOperation: "); + builder.AppendLine($"'{ProvisioningOperation.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Timestamp), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" timestamp: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Timestamp)) + { + builder.Append(" timestamp: "); + var formattedDateTimeString = TypeFormatters.ToString(Timestamp.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Duration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" duration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Duration)) + { + builder.Append(" duration: "); + var formattedTimeSpan = TypeFormatters.ToString(Duration.Value, "P"); + builder.AppendLine($"'{formattedTimeSpan}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceRequestId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serviceRequestId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServiceRequestId)) + { + builder.Append(" serviceRequestId: "); + if (ServiceRequestId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ServiceRequestId}'''"); + } + else + { + builder.AppendLine($"'{ServiceRequestId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StatusCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" statusCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StatusCode)) + { + builder.Append(" statusCode: "); + if (StatusCode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{StatusCode}'''"); + } + else + { + builder.AppendLine($"'{StatusCode}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StatusMessage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" statusMessage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StatusMessage)) + { + builder.Append(" statusMessage: "); + BicepSerializationHelpers.AppendChildObject(builder, StatusMessage, options, 2, false, " statusMessage: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TargetResource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" targetResource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TargetResource)) + { + builder.Append(" targetResource: "); + BicepSerializationHelpers.AppendChildObject(builder, TargetResource, options, 2, false, " targetResource: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("RequestContent", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" request: "); + builder.AppendLine("{"); + builder.Append(" content: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Request)) + { + builder.Append(" request: "); + BicepSerializationHelpers.AppendChildObject(builder, Request, options, 2, false, " request: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("ResponseContent", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" response: "); + builder.AppendLine("{"); + builder.Append(" content: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Response)) + { + builder.Append(" response: "); + BicepSerializationHelpers.AppendChildObject(builder, Response, options, 2, false, " response: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperationProperties)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentOperationProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentOperationProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperationProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.cs new file mode 100644 index 000000000000..1c54513fd042 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationProperties.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment operation properties. + public partial class ArmDeploymentOperationProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentOperationProperties() + { + } + + /// Initializes a new instance of . + /// The name of the current provisioning operation. + /// The state of the provisioning. + /// The date and time of the operation. + /// The duration of the operation. + /// Deployment operation service request id. + /// Operation status code from the resource provider. This property may not be set if a response has not yet been received. + /// Operation status message from the resource provider. This property is optional. It will only be provided if an error was received from the resource provider. + /// The target resource. + /// The HTTP request message. + /// The HTTP response message. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentOperationProperties(ProvisioningOperationKind? provisioningOperation, string provisioningState, DateTimeOffset? timestamp, TimeSpan? duration, string serviceRequestId, string statusCode, StatusMessage statusMessage, TargetResource targetResource, HttpMessage request, HttpMessage response, IDictionary serializedAdditionalRawData) + { + ProvisioningOperation = provisioningOperation; + ProvisioningState = provisioningState; + Timestamp = timestamp; + Duration = duration; + ServiceRequestId = serviceRequestId; + StatusCode = statusCode; + StatusMessage = statusMessage; + TargetResource = targetResource; + Request = request; + Response = response; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the current provisioning operation. + [WirePath("provisioningOperation")] + public ProvisioningOperationKind? ProvisioningOperation { get; } + /// The state of the provisioning. + [WirePath("provisioningState")] + public string ProvisioningState { get; } + /// The date and time of the operation. + [WirePath("timestamp")] + public DateTimeOffset? Timestamp { get; } + /// The duration of the operation. + [WirePath("duration")] + public TimeSpan? Duration { get; } + /// Deployment operation service request id. + [WirePath("serviceRequestId")] + public string ServiceRequestId { get; } + /// Operation status code from the resource provider. This property may not be set if a response has not yet been received. + [WirePath("statusCode")] + public string StatusCode { get; } + /// Operation status message from the resource provider. This property is optional. It will only be provided if an error was received from the resource provider. + [WirePath("statusMessage")] + public StatusMessage StatusMessage { get; } + /// The target resource. + [WirePath("targetResource")] + public TargetResource TargetResource { get; } + /// The HTTP request message. + internal HttpMessage Request { get; } + /// + /// HTTP message content. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("request.content")] + public BinaryData RequestContent + { + get => Request?.Content; + } + + /// The HTTP response message. + internal HttpMessage Response { get; } + /// + /// HTTP message content. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("response.content")] + public BinaryData ResponseContent + { + get => Response?.Content; + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.Serialization.cs new file mode 100644 index 000000000000..dbe9b24b5726 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal partial class ArmDeploymentOperationsListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentOperationsListResult)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentOperationsListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentOperationsListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentOperationsListResult(document.RootElement, options); + } + + internal static ArmDeploymentOperationsListResult DeserializeArmDeploymentOperationsListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmDeploymentOperation.DeserializeArmDeploymentOperation(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentOperationsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperationsListResult)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentOperationsListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentOperationsListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentOperationsListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.cs new file mode 100644 index 000000000000..eee0118934cf --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentOperationsListResult.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.Resources.Deployments.Models +{ + /// List of deployment operations. + internal partial class ArmDeploymentOperationsListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentOperationsListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// An array of deployment operations. + /// The URL to use for getting the next set of results. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentOperationsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// An array of deployment operations. + public IReadOnlyList Value { get; } + /// The URL to use for getting the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.Serialization.cs new file mode 100644 index 000000000000..a3f029d9ce29 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentParametersLink : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentParametersLink)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + if (Optional.IsDefined(ContentVersion)) + { + writer.WritePropertyName("contentVersion"u8); + writer.WriteStringValue(ContentVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentParametersLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentParametersLink)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentParametersLink(document.RootElement, options); + } + + internal static ArmDeploymentParametersLink DeserializeArmDeploymentParametersLink(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri uri = default; + string contentVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + uri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("contentVersion"u8)) + { + contentVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentParametersLink(uri, contentVersion, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" uri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Uri)) + { + builder.Append(" uri: "); + builder.AppendLine($"'{Uri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentVersion)) + { + builder.Append(" contentVersion: "); + if (ContentVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentVersion}'''"); + } + else + { + builder.AppendLine($"'{ContentVersion}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentParametersLink)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentParametersLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentParametersLink(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentParametersLink)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.cs new file mode 100644 index 000000000000..2cff7fb95b17 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentParametersLink.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.Resources.Deployments.Models +{ + /// Entity representing the reference to the deployment parameters. + public partial class ArmDeploymentParametersLink + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 URI of the parameters file. + /// is null. + public ArmDeploymentParametersLink(Uri uri) + { + Argument.AssertNotNull(uri, nameof(uri)); + + Uri = uri; + } + + /// Initializes a new instance of . + /// The URI of the parameters file. + /// If included, must match the ContentVersion in the template. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentParametersLink(Uri uri, string contentVersion, IDictionary serializedAdditionalRawData) + { + Uri = uri; + ContentVersion = contentVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentParametersLink() + { + } + + /// The URI of the parameters file. + [WirePath("uri")] + public Uri Uri { get; set; } + /// If included, must match the ContentVersion in the template. + [WirePath("contentVersion")] + public string ContentVersion { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.Serialization.cs new file mode 100644 index 000000000000..30d482eca72a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.Serialization.cs @@ -0,0 +1,374 @@ +// Copyright (c) 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.Resources.Deployments.Models +{ + public partial class ArmDeploymentProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Template)) + { + writer.WritePropertyName("template"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Template); +#else + using (JsonDocument document = JsonDocument.Parse(Template, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(TemplateLink)) + { + writer.WritePropertyName("templateLink"u8); + writer.WriteObjectValue(TemplateLink, options); + } + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Parameters); +#else + using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(ExternalInputs)) + { + writer.WritePropertyName("externalInputs"u8); + writer.WriteStartObject(); + foreach (var item in ExternalInputs) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(ExternalInputDefinitions)) + { + writer.WritePropertyName("externalInputDefinitions"u8); + writer.WriteStartObject(); + foreach (var item in ExternalInputDefinitions) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(ParametersLink)) + { + writer.WritePropertyName("parametersLink"u8); + writer.WriteObjectValue(ParametersLink, options); + } + if (Optional.IsCollectionDefined(ExtensionConfigs)) + { + writer.WritePropertyName("extensionConfigs"u8); + writer.WriteStartObject(); + foreach (var item in ExtensionConfigs) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartObject(); + foreach (var item0 in item.Value) + { + writer.WritePropertyName(item0.Key); + writer.WriteObjectValue(item0.Value, options); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.ToSerialString()); + if (Optional.IsDefined(DebugSetting)) + { + writer.WritePropertyName("debugSetting"u8); + writer.WriteObjectValue(DebugSetting, options); + } + if (Optional.IsDefined(ErrorDeployment)) + { + writer.WritePropertyName("onErrorDeployment"u8); + writer.WriteObjectValue(ErrorDeployment, options); + } + if (Optional.IsDefined(ExpressionEvaluation)) + { + writer.WritePropertyName("expressionEvaluationOptions"u8); + writer.WriteObjectValue(ExpressionEvaluation, options); + } + if (Optional.IsDefined(ValidationLevel)) + { + writer.WritePropertyName("validationLevel"u8); + writer.WriteStringValue(ValidationLevel.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentProperties(document.RootElement, options); + } + + internal static ArmDeploymentProperties DeserializeArmDeploymentProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData template = default; + ArmDeploymentTemplateLink templateLink = default; + BinaryData parameters = default; + IDictionary externalInputs = default; + IDictionary externalInputDefinitions = default; + ArmDeploymentParametersLink parametersLink = default; + IDictionary> extensionConfigs = default; + ArmDeploymentMode mode = default; + DebugSetting debugSetting = default; + ErrorDeployment onErrorDeployment = default; + ExpressionEvaluationOptions expressionEvaluationOptions = default; + ValidationLevel? validationLevel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("template"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("templateLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateLink = ArmDeploymentTemplateLink.DeserializeArmDeploymentTemplateLink(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("externalInputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ArmDeploymentExternalInput.DeserializeArmDeploymentExternalInput(property0.Value, options)); + } + externalInputs = dictionary; + continue; + } + if (property.NameEquals("externalInputDefinitions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ArmDeploymentExternalInputDefinition.DeserializeArmDeploymentExternalInputDefinition(property0.Value, options)); + } + externalInputDefinitions = dictionary; + continue; + } + if (property.NameEquals("parametersLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parametersLink = ArmDeploymentParametersLink.DeserializeArmDeploymentParametersLink(property.Value, options); + continue; + } + if (property.NameEquals("extensionConfigs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary> dictionary = new Dictionary>(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + Dictionary dictionary0 = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary0.Add(property1.Name, ArmDeploymentExtensionConfigItem.DeserializeArmDeploymentExtensionConfigItem(property1.Value, options)); + } + dictionary.Add(property0.Name, dictionary0); + } + } + extensionConfigs = dictionary; + continue; + } + if (property.NameEquals("mode"u8)) + { + mode = property.Value.GetString().ToArmDeploymentMode(); + continue; + } + if (property.NameEquals("debugSetting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugSetting = DebugSetting.DeserializeDebugSetting(property.Value, options); + continue; + } + if (property.NameEquals("onErrorDeployment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onErrorDeployment = ErrorDeployment.DeserializeErrorDeployment(property.Value, options); + continue; + } + if (property.NameEquals("expressionEvaluationOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expressionEvaluationOptions = ExpressionEvaluationOptions.DeserializeExpressionEvaluationOptions(property.Value, options); + continue; + } + if (property.NameEquals("validationLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationLevel = new ValidationLevel(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentProperties( + template, + templateLink, + parameters, + externalInputs ?? new ChangeTrackingDictionary(), + externalInputDefinitions ?? new ChangeTrackingDictionary(), + parametersLink, + extensionConfigs ?? new ChangeTrackingDictionary>(), + mode, + debugSetting, + onErrorDeployment, + expressionEvaluationOptions, + validationLevel, + 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentProperties)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.cs new file mode 100644 index 000000000000..90393d337620 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentProperties.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; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment properties. + public partial class ArmDeploymentProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload 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 mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public ArmDeploymentProperties(ArmDeploymentMode mode) + { + ExternalInputs = new ChangeTrackingDictionary(); + ExternalInputDefinitions = new ChangeTrackingDictionary(); + ExtensionConfigs = new ChangeTrackingDictionary>(); + Mode = mode; + } + + /// Initializes a new instance of . + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// External input values, used by external tooling for parameter evaluation. + /// External input definitions, used by external tooling to define expected external input values. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The configurations to use for deployment extensions. The keys of this object are deployment extension aliases as defined in the deployment template. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + /// The validation level of the deployment. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentProperties(BinaryData template, ArmDeploymentTemplateLink templateLink, BinaryData parameters, IDictionary externalInputs, IDictionary externalInputDefinitions, ArmDeploymentParametersLink parametersLink, IDictionary> extensionConfigs, ArmDeploymentMode mode, DebugSetting debugSetting, ErrorDeployment errorDeployment, ExpressionEvaluationOptions expressionEvaluation, ValidationLevel? validationLevel, IDictionary serializedAdditionalRawData) + { + Template = template; + TemplateLink = templateLink; + Parameters = parameters; + ExternalInputs = externalInputs; + ExternalInputDefinitions = externalInputDefinitions; + ParametersLink = parametersLink; + ExtensionConfigs = extensionConfigs; + Mode = mode; + DebugSetting = debugSetting; + ErrorDeployment = errorDeployment; + ExpressionEvaluation = expressionEvaluation; + ValidationLevel = validationLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentProperties() + { + } + + /// + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("template")] + public BinaryData Template { get; set; } + /// The URI of the template. Use either the templateLink property or the template property, but not both. + [WirePath("templateLink")] + public ArmDeploymentTemplateLink TemplateLink { get; set; } + /// + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("parameters")] + public BinaryData Parameters { get; set; } + /// External input values, used by external tooling for parameter evaluation. + [WirePath("externalInputs")] + public IDictionary ExternalInputs { get; } + /// External input definitions, used by external tooling to define expected external input values. + [WirePath("externalInputDefinitions")] + public IDictionary ExternalInputDefinitions { get; } + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + [WirePath("parametersLink")] + public ArmDeploymentParametersLink ParametersLink { get; set; } + /// The configurations to use for deployment extensions. The keys of this object are deployment extension aliases as defined in the deployment template. + [WirePath("extensionConfigs")] + public IDictionary> ExtensionConfigs { get; } + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + [WirePath("mode")] + public ArmDeploymentMode Mode { get; } + /// The debug setting of the deployment. + internal DebugSetting DebugSetting { get; set; } + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + [WirePath("debugSetting.detailLevel")] + public string DebugSettingDetailLevel + { + get => DebugSetting is null ? default : DebugSetting.DetailLevel; + set + { + if (DebugSetting is null) + DebugSetting = new DebugSetting(); + DebugSetting.DetailLevel = value; + } + } + + /// The deployment on error behavior. + [WirePath("onErrorDeployment")] + public ErrorDeployment ErrorDeployment { get; set; } + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + internal ExpressionEvaluationOptions ExpressionEvaluation { get; set; } + /// The scope to be used for evaluation of parameters, variables and functions in a nested template. + [WirePath("expressionEvaluationOptions.scope")] + public ExpressionEvaluationScope? ExpressionEvaluationScope + { + get => ExpressionEvaluation is null ? default : ExpressionEvaluation.Scope; + set + { + if (ExpressionEvaluation is null) + ExpressionEvaluation = new ExpressionEvaluationOptions(); + ExpressionEvaluation.Scope = value; + } + } + + /// The validation level of the deployment. + [WirePath("validationLevel")] + public ValidationLevel? ValidationLevel { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.Serialization.cs new file mode 100644 index 000000000000..5abc8d9af56c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.Serialization.cs @@ -0,0 +1,893 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentPropertiesExtended : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentPropertiesExtended)} 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" && Optional.IsDefined(CorrelationId)) + { + writer.WritePropertyName("correlationId"u8); + writer.WriteStringValue(CorrelationId); + } + if (options.Format != "W" && Optional.IsDefined(Timestamp)) + { + writer.WritePropertyName("timestamp"u8); + writer.WriteStringValue(Timestamp.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(Duration)) + { + writer.WritePropertyName("duration"u8); + writer.WriteStringValue(Duration.Value, "P"); + } + if (options.Format != "W" && Optional.IsDefined(Outputs)) + { + writer.WritePropertyName("outputs"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Outputs); +#else + using (JsonDocument document = JsonDocument.Parse(Outputs, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && Optional.IsCollectionDefined(Providers)) + { + writer.WritePropertyName("providers"u8); + writer.WriteStartArray(); + foreach (var item in Providers) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Dependencies)) + { + writer.WritePropertyName("dependencies"u8); + writer.WriteStartArray(); + foreach (var item in Dependencies) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(TemplateLink)) + { + writer.WritePropertyName("templateLink"u8); + writer.WriteObjectValue(TemplateLink, options); + } + if (options.Format != "W" && Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Parameters); +#else + using (JsonDocument document = JsonDocument.Parse(Parameters, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && Optional.IsDefined(ParametersLink)) + { + writer.WritePropertyName("parametersLink"u8); + writer.WriteObjectValue(ParametersLink, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Extensions)) + { + writer.WritePropertyName("extensions"u8); + writer.WriteStartArray(); + foreach (var item in Extensions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Mode)) + { + writer.WritePropertyName("mode"u8); + writer.WriteStringValue(Mode.Value.ToSerialString()); + } + if (options.Format != "W" && Optional.IsDefined(DebugSetting)) + { + writer.WritePropertyName("debugSetting"u8); + writer.WriteObjectValue(DebugSetting, options); + } + if (options.Format != "W" && Optional.IsDefined(ErrorDeployment)) + { + writer.WritePropertyName("onErrorDeployment"u8); + writer.WriteObjectValue(ErrorDeployment, options); + } + if (options.Format != "W" && Optional.IsDefined(TemplateHash)) + { + writer.WritePropertyName("templateHash"u8); + writer.WriteStringValue(TemplateHash); + } + if (options.Format != "W" && Optional.IsCollectionDefined(OutputResourceDetails)) + { + writer.WritePropertyName("outputResources"u8); + writer.WriteStartArray(); + foreach (var item in OutputResourceDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ValidatedResourceDetails)) + { + writer.WritePropertyName("validatedResources"u8); + writer.WriteStartArray(); + foreach (var item in ValidatedResourceDetails) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Diagnostics)) + { + writer.WritePropertyName("diagnostics"u8); + writer.WriteStartArray(); + foreach (var item in Diagnostics) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ValidationLevel)) + { + writer.WritePropertyName("validationLevel"u8); + writer.WriteStringValue(ValidationLevel.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentPropertiesExtended IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentPropertiesExtended)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentPropertiesExtended(document.RootElement, options); + } + + internal static ArmDeploymentPropertiesExtended DeserializeArmDeploymentPropertiesExtended(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourcesProvisioningState? provisioningState = default; + string correlationId = default; + DateTimeOffset? timestamp = default; + TimeSpan? duration = default; + BinaryData outputs = default; + IReadOnlyList providers = default; + IReadOnlyList dependencies = default; + ArmDeploymentTemplateLink templateLink = default; + BinaryData parameters = default; + ArmDeploymentParametersLink parametersLink = default; + IReadOnlyList extensions = default; + ArmDeploymentMode? mode = default; + DebugSetting debugSetting = default; + ErrorDeploymentExtended onErrorDeployment = default; + string templateHash = default; + IReadOnlyList outputResources = default; + IReadOnlyList validatedResources = default; + ResponseError error = default; + IReadOnlyList diagnostics = default; + ValidationLevel? validationLevel = 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 ResourcesProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("timestamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + timestamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("duration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + duration = property.Value.GetTimeSpan("P"); + continue; + } + if (property.NameEquals("outputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outputs = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("providers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Provider.DeserializeProvider(item, options)); + } + providers = array; + continue; + } + if (property.NameEquals("dependencies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmDependency.DeserializeArmDependency(item, options)); + } + dependencies = array; + continue; + } + if (property.NameEquals("templateLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateLink = ArmDeploymentTemplateLink.DeserializeArmDeploymentTemplateLink(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("parametersLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parametersLink = ArmDeploymentParametersLink.DeserializeArmDeploymentParametersLink(property.Value, options); + continue; + } + if (property.NameEquals("extensions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmDeploymentExtensionDefinition.DeserializeArmDeploymentExtensionDefinition(item, options)); + } + extensions = array; + continue; + } + if (property.NameEquals("mode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + mode = property.Value.GetString().ToArmDeploymentMode(); + continue; + } + if (property.NameEquals("debugSetting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugSetting = DebugSetting.DeserializeDebugSetting(property.Value, options); + continue; + } + if (property.NameEquals("onErrorDeployment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onErrorDeployment = ErrorDeploymentExtended.DeserializeErrorDeploymentExtended(property.Value, options); + continue; + } + if (property.NameEquals("templateHash"u8)) + { + templateHash = property.Value.GetString(); + continue; + } + if (property.NameEquals("outputResources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmResourceReference.DeserializeArmResourceReference(item, options)); + } + outputResources = array; + continue; + } + if (property.NameEquals("validatedResources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ArmResourceReference.DeserializeArmResourceReference(item, options)); + } + validatedResources = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("diagnostics"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeploymentDiagnosticsDefinition.DeserializeDeploymentDiagnosticsDefinition(item, options)); + } + diagnostics = array; + continue; + } + if (property.NameEquals("validationLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationLevel = new ValidationLevel(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentPropertiesExtended( + provisioningState, + correlationId, + timestamp, + duration, + outputs, + providers ?? new ChangeTrackingList(), + dependencies ?? new ChangeTrackingList(), + templateLink, + parameters, + parametersLink, + extensions ?? new ChangeTrackingList(), + mode, + debugSetting, + onErrorDeployment, + templateHash, + outputResources ?? new ChangeTrackingList(), + validatedResources ?? new ChangeTrackingList(), + error, + diagnostics ?? new ChangeTrackingList(), + validationLevel, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CorrelationId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" correlationId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CorrelationId)) + { + builder.Append(" correlationId: "); + if (CorrelationId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CorrelationId}'''"); + } + else + { + builder.AppendLine($"'{CorrelationId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Timestamp), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" timestamp: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Timestamp)) + { + builder.Append(" timestamp: "); + var formattedDateTimeString = TypeFormatters.ToString(Timestamp.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Duration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" duration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Duration)) + { + builder.Append(" duration: "); + var formattedTimeSpan = TypeFormatters.ToString(Duration.Value, "P"); + builder.AppendLine($"'{formattedTimeSpan}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Outputs), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" outputs: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Outputs)) + { + builder.Append(" outputs: "); + builder.AppendLine($"'{Outputs.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Providers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" providers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Providers)) + { + if (Providers.Any()) + { + builder.Append(" providers: "); + builder.AppendLine("["); + foreach (var item in Providers) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " providers: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Dependencies), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dependencies: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Dependencies)) + { + if (Dependencies.Any()) + { + builder.Append(" dependencies: "); + builder.AppendLine("["); + foreach (var item in Dependencies) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " dependencies: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TemplateLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" templateLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TemplateLink)) + { + builder.Append(" templateLink: "); + BicepSerializationHelpers.AppendChildObject(builder, TemplateLink, options, 2, false, " templateLink: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Parameters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" parameters: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Parameters)) + { + builder.Append(" parameters: "); + builder.AppendLine($"'{Parameters.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ParametersLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" parametersLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ParametersLink)) + { + builder.Append(" parametersLink: "); + BicepSerializationHelpers.AppendChildObject(builder, ParametersLink, options, 2, false, " parametersLink: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Extensions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extensions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Extensions)) + { + if (Extensions.Any()) + { + builder.Append(" extensions: "); + builder.AppendLine("["); + foreach (var item in Extensions) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " extensions: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Mode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" mode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Mode)) + { + builder.Append(" mode: "); + builder.AppendLine($"'{Mode.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DebugSettingDetailLevel", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" debugSetting: "); + builder.AppendLine("{"); + builder.Append(" detailLevel: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(DebugSetting)) + { + builder.Append(" debugSetting: "); + BicepSerializationHelpers.AppendChildObject(builder, DebugSetting, options, 2, false, " debugSetting: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ErrorDeployment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" onErrorDeployment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ErrorDeployment)) + { + builder.Append(" onErrorDeployment: "); + BicepSerializationHelpers.AppendChildObject(builder, ErrorDeployment, options, 2, false, " onErrorDeployment: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TemplateHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" templateHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TemplateHash)) + { + builder.Append(" templateHash: "); + if (TemplateHash.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{TemplateHash}'''"); + } + else + { + builder.AppendLine($"'{TemplateHash}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OutputResourceDetails), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" outputResources: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(OutputResourceDetails)) + { + if (OutputResourceDetails.Any()) + { + builder.Append(" outputResources: "); + builder.AppendLine("["); + foreach (var item in OutputResourceDetails) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " outputResources: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ValidatedResourceDetails), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" validatedResources: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ValidatedResourceDetails)) + { + if (ValidatedResourceDetails.Any()) + { + builder.Append(" validatedResources: "); + builder.AppendLine("["); + foreach (var item in ValidatedResourceDetails) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " validatedResources: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Diagnostics), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diagnostics: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Diagnostics)) + { + if (Diagnostics.Any()) + { + builder.Append(" diagnostics: "); + builder.AppendLine("["); + foreach (var item in Diagnostics) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " diagnostics: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ValidationLevel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" validationLevel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ValidationLevel)) + { + builder.Append(" validationLevel: "); + builder.AppendLine($"'{ValidationLevel.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentPropertiesExtended)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentPropertiesExtended IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentPropertiesExtended(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentPropertiesExtended)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.cs new file mode 100644 index 000000000000..720683ed1a3d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentPropertiesExtended.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment properties with additional details. + public partial class ArmDeploymentPropertiesExtended + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentPropertiesExtended() + { + Providers = new ChangeTrackingList(); + Dependencies = new ChangeTrackingList(); + Extensions = new ChangeTrackingList(); + OutputResourceDetails = new ChangeTrackingList(); + ValidatedResourceDetails = new ChangeTrackingList(); + Diagnostics = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Denotes the state of provisioning. + /// The correlation ID of the deployment. + /// The timestamp of the template deployment. + /// The duration of the template deployment. + /// Key/value pairs that represent deployment output. + /// The list of resource providers needed for the deployment. + /// The list of deployment dependencies. + /// The URI referencing the template. + /// Deployment parameters. + /// The URI referencing the parameters. + /// The extensions used in this deployment. + /// The deployment mode. Possible values are Incremental and Complete. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// The hash produced for the template. + /// Array of provisioned resources. + /// Array of validated resources. + /// The deployment error. + /// Contains diagnostic information collected during validation process. + /// The validation level of the deployment. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentPropertiesExtended(ResourcesProvisioningState? provisioningState, string correlationId, DateTimeOffset? timestamp, TimeSpan? duration, BinaryData outputs, IReadOnlyList providers, IReadOnlyList dependencies, ArmDeploymentTemplateLink templateLink, BinaryData parameters, ArmDeploymentParametersLink parametersLink, IReadOnlyList extensions, ArmDeploymentMode? mode, DebugSetting debugSetting, ErrorDeploymentExtended errorDeployment, string templateHash, IReadOnlyList outputResourceDetails, IReadOnlyList validatedResourceDetails, ResponseError error, IReadOnlyList diagnostics, ValidationLevel? validationLevel, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + CorrelationId = correlationId; + Timestamp = timestamp; + Duration = duration; + Outputs = outputs; + Providers = providers; + Dependencies = dependencies; + TemplateLink = templateLink; + Parameters = parameters; + ParametersLink = parametersLink; + Extensions = extensions; + Mode = mode; + DebugSetting = debugSetting; + ErrorDeployment = errorDeployment; + TemplateHash = templateHash; + OutputResourceDetails = outputResourceDetails; + ValidatedResourceDetails = validatedResourceDetails; + Error = error; + Diagnostics = diagnostics; + ValidationLevel = validationLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Denotes the state of provisioning. + [WirePath("provisioningState")] + public ResourcesProvisioningState? ProvisioningState { get; } + /// The correlation ID of the deployment. + [WirePath("correlationId")] + public string CorrelationId { get; } + /// The timestamp of the template deployment. + [WirePath("timestamp")] + public DateTimeOffset? Timestamp { get; } + /// The duration of the template deployment. + [WirePath("duration")] + public TimeSpan? Duration { get; } + /// + /// Key/value pairs that represent deployment output. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("outputs")] + public BinaryData Outputs { get; } + /// The list of resource providers needed for the deployment. + [WirePath("providers")] + public IReadOnlyList Providers { get; } + /// The list of deployment dependencies. + [WirePath("dependencies")] + public IReadOnlyList Dependencies { get; } + /// The URI referencing the template. + [WirePath("templateLink")] + public ArmDeploymentTemplateLink TemplateLink { get; } + /// + /// Deployment parameters. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("parameters")] + public BinaryData Parameters { get; } + /// The URI referencing the parameters. + [WirePath("parametersLink")] + public ArmDeploymentParametersLink ParametersLink { get; } + /// The extensions used in this deployment. + [WirePath("extensions")] + public IReadOnlyList Extensions { get; } + /// The deployment mode. Possible values are Incremental and Complete. + [WirePath("mode")] + public ArmDeploymentMode? Mode { get; } + /// The debug setting of the deployment. + internal DebugSetting DebugSetting { get; } + + /// The deployment on error behavior. + [WirePath("onErrorDeployment")] + public ErrorDeploymentExtended ErrorDeployment { get; } + /// The hash produced for the template. + [WirePath("templateHash")] + public string TemplateHash { get; } + /// Array of provisioned resources. + [WirePath("outputResources")] + public IReadOnlyList OutputResourceDetails { get; } + /// Array of validated resources. + [WirePath("validatedResources")] + public IReadOnlyList ValidatedResourceDetails { get; } + /// The deployment error. + [WirePath("error")] + public ResponseError Error { get; } + /// Contains diagnostic information collected during validation process. + [WirePath("diagnostics")] + public IReadOnlyList Diagnostics { get; } + /// The validation level of the deployment. + [WirePath("validationLevel")] + public ValidationLevel? ValidationLevel { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.Serialization.cs new file mode 100644 index 000000000000..140c5af782c0 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.Serialization.cs @@ -0,0 +1,308 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentTemplateLink : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentTemplateLink)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(RelativePath)) + { + writer.WritePropertyName("relativePath"u8); + writer.WriteStringValue(RelativePath); + } + if (Optional.IsDefined(ContentVersion)) + { + writer.WritePropertyName("contentVersion"u8); + writer.WriteStringValue(ContentVersion); + } + if (Optional.IsDefined(QueryString)) + { + writer.WritePropertyName("queryString"u8); + writer.WriteStringValue(QueryString); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentTemplateLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentTemplateLink)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentTemplateLink(document.RootElement, options); + } + + internal static ArmDeploymentTemplateLink DeserializeArmDeploymentTemplateLink(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri uri = default; + string id = default; + string relativePath = default; + string contentVersion = default; + string queryString = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("relativePath"u8)) + { + relativePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentVersion"u8)) + { + contentVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("queryString"u8)) + { + queryString = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentTemplateLink( + uri, + id, + relativePath, + contentVersion, + queryString, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" uri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Uri)) + { + builder.Append(" uri: "); + builder.AppendLine($"'{Uri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RelativePath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" relativePath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RelativePath)) + { + builder.Append(" relativePath: "); + if (RelativePath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RelativePath}'''"); + } + else + { + builder.AppendLine($"'{RelativePath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentVersion)) + { + builder.Append(" contentVersion: "); + if (ContentVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentVersion}'''"); + } + else + { + builder.AppendLine($"'{ContentVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueryString), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" queryString: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QueryString)) + { + builder.Append(" queryString: "); + if (QueryString.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{QueryString}'''"); + } + else + { + builder.AppendLine($"'{QueryString}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentTemplateLink)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentTemplateLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentTemplateLink(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentTemplateLink)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.cs new file mode 100644 index 000000000000..5414bd0c10f1 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentTemplateLink.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Entity representing the reference to the template. + public partial class ArmDeploymentTemplateLink + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentTemplateLink() + { + } + + /// Initializes a new instance of . + /// The URI of the template to deploy. Use either the uri or id property, but not both. + /// The resource id of a Template Spec. Use either the id or uri property, but not both. + /// The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs. + /// If included, must match the ContentVersion in the template. + /// The query string (for example, a SAS token) to be used with the templateLink URI. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentTemplateLink(Uri uri, string id, string relativePath, string contentVersion, string queryString, IDictionary serializedAdditionalRawData) + { + Uri = uri; + Id = id; + RelativePath = relativePath; + ContentVersion = contentVersion; + QueryString = queryString; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The URI of the template to deploy. Use either the uri or id property, but not both. + [WirePath("uri")] + public Uri Uri { get; set; } + /// The resource id of a Template Spec. Use either the id or uri property, but not both. + [WirePath("id")] + public string Id { get; set; } + /// The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs. + [WirePath("relativePath")] + public string RelativePath { get; set; } + /// If included, must match the ContentVersion in the template. + [WirePath("contentVersion")] + public string ContentVersion { get; set; } + /// The query string (for example, a SAS token) to be used with the templateLink URI. + [WirePath("queryString")] + public string QueryString { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.Serialization.cs new file mode 100644 index 000000000000..3fbed2672947 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.Serialization.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmDeploymentValidateResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentValidateResult)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (options.Format != "W" && Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ArmDeploymentValidateResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentValidateResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentValidateResult(document.RootElement, options); + } + + internal static ArmDeploymentValidateResult DeserializeArmDeploymentValidateResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseError error = default; + ArmDeploymentPropertiesExtended 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("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ArmDeploymentPropertiesExtended.DeserializeArmDeploymentPropertiesExtended(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 ArmDeploymentValidateResult( + id, + name, + type, + systemData, + error, + properties, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmDeploymentValidateResult)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentValidateResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentValidateResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentValidateResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.cs new file mode 100644 index 000000000000..0f3e788efa0a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentValidateResult.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Information from validate template deployment response. + public partial class ArmDeploymentValidateResult : 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 ArmDeploymentValidateResult() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The deployment validation error. + /// The template deployment properties. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentValidateResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ResponseError error, ArmDeploymentPropertiesExtended properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Error = error; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The deployment validation error. + [WirePath("error")] + public ResponseError Error { get; } + /// The template deployment properties. + [WirePath("properties")] + public ArmDeploymentPropertiesExtended Properties { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.Serialization.cs new file mode 100644 index 000000000000..9dcd4da24416 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) 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.Resources.Deployments.Models +{ + public partial class ArmDeploymentWhatIfContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentWhatIfContent)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentWhatIfContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentWhatIfContent(document.RootElement, options); + } + + internal static ArmDeploymentWhatIfContent DeserializeArmDeploymentWhatIfContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + ArmDeploymentWhatIfProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + properties = ArmDeploymentWhatIfProperties.DeserializeArmDeploymentWhatIfProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentWhatIfContent(location, properties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfContent)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentWhatIfContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentWhatIfContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.cs new file mode 100644 index 000000000000..d3f1c96607cb --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfContent.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; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment What-if operation parameters. + public partial class ArmDeploymentWhatIfContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 deployment properties. + /// is null. + public ArmDeploymentWhatIfContent(ArmDeploymentWhatIfProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Properties = properties; + } + + /// Initializes a new instance of . + /// The location to store the deployment data, only required at the tenant and management group scope. + /// The deployment properties. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentWhatIfContent(AzureLocation? location, ArmDeploymentWhatIfProperties properties, IDictionary serializedAdditionalRawData) + { + Location = location; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentWhatIfContent() + { + } + + /// The location to store the deployment data, only required at the tenant and management group scope. + [WirePath("location")] + public AzureLocation? Location { get; set; } + /// The deployment properties. + [WirePath("properties")] + public ArmDeploymentWhatIfProperties Properties { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.Serialization.cs new file mode 100644 index 000000000000..76bb6a04323d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.Serialization.cs @@ -0,0 +1,276 @@ +// Copyright (c) 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.Resources.Deployments.Models +{ + public partial class ArmDeploymentWhatIfProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentWhatIfProperties)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(WhatIfSettings)) + { + writer.WritePropertyName("whatIfSettings"u8); + writer.WriteObjectValue(WhatIfSettings, options); + } + } + + ArmDeploymentWhatIfProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentWhatIfProperties(document.RootElement, options); + } + + internal static ArmDeploymentWhatIfProperties DeserializeArmDeploymentWhatIfProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ArmDeploymentWhatIfSettings whatIfSettings = default; + BinaryData template = default; + ArmDeploymentTemplateLink templateLink = default; + BinaryData parameters = default; + IDictionary externalInputs = default; + IDictionary externalInputDefinitions = default; + ArmDeploymentParametersLink parametersLink = default; + IDictionary> extensionConfigs = default; + ArmDeploymentMode mode = default; + DebugSetting debugSetting = default; + ErrorDeployment onErrorDeployment = default; + ExpressionEvaluationOptions expressionEvaluationOptions = default; + ValidationLevel? validationLevel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("whatIfSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + whatIfSettings = ArmDeploymentWhatIfSettings.DeserializeArmDeploymentWhatIfSettings(property.Value, options); + continue; + } + if (property.NameEquals("template"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("templateLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + templateLink = ArmDeploymentTemplateLink.DeserializeArmDeploymentTemplateLink(property.Value, options); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("externalInputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ArmDeploymentExternalInput.DeserializeArmDeploymentExternalInput(property0.Value, options)); + } + externalInputs = dictionary; + continue; + } + if (property.NameEquals("externalInputDefinitions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, ArmDeploymentExternalInputDefinition.DeserializeArmDeploymentExternalInputDefinition(property0.Value, options)); + } + externalInputDefinitions = dictionary; + continue; + } + if (property.NameEquals("parametersLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parametersLink = ArmDeploymentParametersLink.DeserializeArmDeploymentParametersLink(property.Value, options); + continue; + } + if (property.NameEquals("extensionConfigs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary> dictionary = new Dictionary>(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + Dictionary dictionary0 = new Dictionary(); + foreach (var property1 in property0.Value.EnumerateObject()) + { + dictionary0.Add(property1.Name, ArmDeploymentExtensionConfigItem.DeserializeArmDeploymentExtensionConfigItem(property1.Value, options)); + } + dictionary.Add(property0.Name, dictionary0); + } + } + extensionConfigs = dictionary; + continue; + } + if (property.NameEquals("mode"u8)) + { + mode = property.Value.GetString().ToArmDeploymentMode(); + continue; + } + if (property.NameEquals("debugSetting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + debugSetting = DebugSetting.DeserializeDebugSetting(property.Value, options); + continue; + } + if (property.NameEquals("onErrorDeployment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + onErrorDeployment = ErrorDeployment.DeserializeErrorDeployment(property.Value, options); + continue; + } + if (property.NameEquals("expressionEvaluationOptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expressionEvaluationOptions = ExpressionEvaluationOptions.DeserializeExpressionEvaluationOptions(property.Value, options); + continue; + } + if (property.NameEquals("validationLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationLevel = new ValidationLevel(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentWhatIfProperties( + template, + templateLink, + parameters, + externalInputs ?? new ChangeTrackingDictionary(), + externalInputDefinitions ?? new ChangeTrackingDictionary(), + parametersLink, + extensionConfigs ?? new ChangeTrackingDictionary>(), + mode, + debugSetting, + onErrorDeployment, + expressionEvaluationOptions, + validationLevel, + serializedAdditionalRawData, + whatIfSettings); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfProperties)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentWhatIfProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentWhatIfProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.cs new file mode 100644 index 000000000000..74e41adfc963 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfProperties.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment What-if properties. + public partial class ArmDeploymentWhatIfProperties : ArmDeploymentProperties + { + /// Initializes a new instance of . + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + public ArmDeploymentWhatIfProperties(ArmDeploymentMode mode) : base(mode) + { + } + + /// Initializes a new instance of . + /// The template content. You use this element when you want to pass the template syntax directly in the request rather than link to an existing template. It can be a JObject or well-formed JSON string. Use either the templateLink property or the template property, but not both. + /// The URI of the template. Use either the templateLink property or the template property, but not both. + /// Name and value pairs that define the deployment parameters for the template. You use this element when you want to provide the parameter values directly in the request rather than link to an existing parameter file. Use either the parametersLink property or the parameters property, but not both. It can be a JObject or a well formed JSON string. + /// External input values, used by external tooling for parameter evaluation. + /// External input definitions, used by external tooling to define expected external input values. + /// The URI of parameters file. You use this element to link to an existing parameters file. Use either the parametersLink property or the parameters property, but not both. + /// The configurations to use for deployment extensions. The keys of this object are deployment extension aliases as defined in the deployment template. + /// The mode that is used to deploy resources. This value can be either Incremental or Complete. In Incremental mode, resources are deployed without deleting existing resources that are not included in the template. In Complete mode, resources are deployed and existing resources in the resource group that are not included in the template are deleted. Be careful when using Complete mode as you may unintentionally delete resources. + /// The debug setting of the deployment. + /// The deployment on error behavior. + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. Only applicable to nested templates. If not specified, default value is outer. + /// The validation level of the deployment. + /// Keeps track of any properties unknown to the library. + /// Optional What-If operation settings. + internal ArmDeploymentWhatIfProperties(BinaryData template, ArmDeploymentTemplateLink templateLink, BinaryData parameters, IDictionary externalInputs, IDictionary externalInputDefinitions, ArmDeploymentParametersLink parametersLink, IDictionary> extensionConfigs, ArmDeploymentMode mode, DebugSetting debugSetting, ErrorDeployment errorDeployment, ExpressionEvaluationOptions expressionEvaluation, ValidationLevel? validationLevel, IDictionary serializedAdditionalRawData, ArmDeploymentWhatIfSettings whatIfSettings) : base(template, templateLink, parameters, externalInputs, externalInputDefinitions, parametersLink, extensionConfigs, mode, debugSetting, errorDeployment, expressionEvaluation, validationLevel, serializedAdditionalRawData) + { + WhatIfSettings = whatIfSettings; + } + + /// Initializes a new instance of for deserialization. + internal ArmDeploymentWhatIfProperties() + { + } + + /// Optional What-If operation settings. + internal ArmDeploymentWhatIfSettings WhatIfSettings { get; set; } + /// The format of the What-If results. + [WirePath("whatIfSettings.resultFormat")] + public WhatIfResultFormat? WhatIfResultFormat + { + get => WhatIfSettings is null ? default : WhatIfSettings.ResultFormat; + set + { + if (WhatIfSettings is null) + WhatIfSettings = new ArmDeploymentWhatIfSettings(); + WhatIfSettings.ResultFormat = value; + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.Serialization.cs new file mode 100644 index 000000000000..568a128eb9c5 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.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.Resources.Deployments.Models +{ + internal partial class ArmDeploymentWhatIfSettings : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmDeploymentWhatIfSettings)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResultFormat)) + { + writer.WritePropertyName("resultFormat"u8); + writer.WriteStringValue(ResultFormat.Value.ToSerialString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmDeploymentWhatIfSettings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfSettings)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmDeploymentWhatIfSettings(document.RootElement, options); + } + + internal static ArmDeploymentWhatIfSettings DeserializeArmDeploymentWhatIfSettings(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WhatIfResultFormat? resultFormat = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resultFormat"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resultFormat = property.Value.GetString().ToWhatIfResultFormat(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmDeploymentWhatIfSettings(resultFormat, 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfSettings)} does not support writing '{options.Format}' format."); + } + } + + ArmDeploymentWhatIfSettings IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmDeploymentWhatIfSettings(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmDeploymentWhatIfSettings)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.cs new file mode 100644 index 000000000000..29d25f167aec --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmDeploymentWhatIfSettings.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment What-If operation settings. + internal partial class ArmDeploymentWhatIfSettings + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmDeploymentWhatIfSettings() + { + } + + /// Initializes a new instance of . + /// The format of the What-If results. + /// Keeps track of any properties unknown to the library. + internal ArmDeploymentWhatIfSettings(WhatIfResultFormat? resultFormat, IDictionary serializedAdditionalRawData) + { + ResultFormat = resultFormat; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The format of the What-If results. + [WirePath("resultFormat")] + public WhatIfResultFormat? ResultFormat { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.Serialization.cs new file mode 100644 index 000000000000..01abf1c8598e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.Serialization.cs @@ -0,0 +1,307 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ArmResourceReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ArmResourceReference)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteObjectValue(Extension, options); + } + if (options.Format != "W" && Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(Identifiers)) + { + writer.WritePropertyName("identifiers"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Identifiers); +#else + using (JsonDocument document = JsonDocument.Parse(Identifiers, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ArmResourceReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ArmResourceReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeArmResourceReference(document.RootElement, options); + } + + internal static ArmResourceReference DeserializeArmResourceReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + ArmDeploymentExtensionDefinition extension = default; + string resourceType = default; + BinaryData identifiers = default; + string apiVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extension = ArmDeploymentExtensionDefinition.DeserializeArmDeploymentExtensionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("identifiers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifiers = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ArmResourceReference( + id, + extension, + resourceType, + identifiers, + apiVersion, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Extension), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extension: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Extension)) + { + builder.Append(" extension: "); + BicepSerializationHelpers.AppendChildObject(builder, Extension, options, 2, false, " extension: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + if (ResourceType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceType}'''"); + } + else + { + builder.AppendLine($"'{ResourceType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identifiers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identifiers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identifiers)) + { + builder.Append(" identifiers: "); + builder.AppendLine($"'{Identifiers.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ApiVersion)) + { + builder.Append(" apiVersion: "); + if (ApiVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ApiVersion}'''"); + } + else + { + builder.AppendLine($"'{ApiVersion}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ArmResourceReference)} does not support writing '{options.Format}' format."); + } + } + + ArmResourceReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeArmResourceReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ArmResourceReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.cs new file mode 100644 index 000000000000..c2062977858c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ArmResourceReference.cs @@ -0,0 +1,116 @@ +// 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.Resources.Deployments.Models +{ + /// The resource Id model. + public partial class ArmResourceReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ArmResourceReference() + { + } + + /// Initializes a new instance of . + /// The fully qualified Azure resource ID. + /// The extension the resource was deployed with. + /// The resource type. + /// The extensible resource identifiers. + /// The API version the resource was deployed with. + /// Keeps track of any properties unknown to the library. + internal ArmResourceReference(ResourceIdentifier id, ArmDeploymentExtensionDefinition extension, string resourceType, BinaryData identifiers, string apiVersion, IDictionary serializedAdditionalRawData) + { + Id = id; + Extension = extension; + ResourceType = resourceType; + Identifiers = identifiers; + ApiVersion = apiVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The fully qualified Azure resource ID. + [WirePath("id")] + public ResourceIdentifier Id { get; } + /// The extension the resource was deployed with. + [WirePath("extension")] + public ArmDeploymentExtensionDefinition Extension { get; } + /// The resource type. + [WirePath("resourceType")] + public string ResourceType { get; } + /// + /// The extensible resource identifiers. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("identifiers")] + public BinaryData Identifiers { get; } + /// The API version the resource was deployed with. + [WirePath("apiVersion")] + public string ApiVersion { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/AzureResourceManagerResourcesDeploymentsContext.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/AzureResourceManagerResourcesDeploymentsContext.cs new file mode 100644 index 000000000000..6049cb590dab --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/AzureResourceManagerResourcesDeploymentsContext.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; + +namespace Azure.ResourceManager.Resources.Deployments +{ + /// + /// Context class which will be filled in by the System.ClientModel.SourceGeneration. + /// For more information see 'https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/System.ClientModel/src/docs/ModelReaderWriterContext.md' + /// + public partial class AzureResourceManagerResourcesDeploymentsContext : ModelReaderWriterContext + { + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.Serialization.cs new file mode 100644 index 000000000000..b95b24c6a3b2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class BasicArmDependency : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(BasicArmDependency)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (Optional.IsDefined(ResourceName)) + { + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + BasicArmDependency IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BasicArmDependency)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBasicArmDependency(document.RootElement, options); + } + + internal static BasicArmDependency DeserializeBasicArmDependency(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ResourceType? resourceType = default; + string resourceName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BasicArmDependency(id, resourceType, resourceName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + builder.AppendLine($"'{ResourceType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceName)) + { + builder.Append(" resourceName: "); + if (ResourceName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceName}'''"); + } + else + { + builder.AppendLine($"'{ResourceName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(BasicArmDependency)} does not support writing '{options.Format}' format."); + } + } + + BasicArmDependency IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBasicArmDependency(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BasicArmDependency)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.cs new file mode 100644 index 000000000000..1d419be44a06 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/BasicArmDependency.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment dependency information. + public partial class BasicArmDependency + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 BasicArmDependency() + { + } + + /// Initializes a new instance of . + /// The ID of the dependency. + /// The dependency resource type. + /// The dependency resource name. + /// Keeps track of any properties unknown to the library. + internal BasicArmDependency(string id, ResourceType? resourceType, string resourceName, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceType = resourceType; + ResourceName = resourceName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The ID of the dependency. + [WirePath("id")] + public string Id { get; } + /// The dependency resource type. + [WirePath("resourceType")] + public ResourceType? ResourceType { get; } + /// The dependency resource name. + [WirePath("resourceName")] + public string ResourceName { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.Serialization.cs new file mode 100644 index 000000000000..7c906c51b7f3 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal partial class DebugSetting : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DebugSetting)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DetailLevel)) + { + writer.WritePropertyName("detailLevel"u8); + writer.WriteStringValue(DetailLevel); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DebugSetting IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DebugSetting)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDebugSetting(document.RootElement, options); + } + + internal static DebugSetting DeserializeDebugSetting(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string detailLevel = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("detailLevel"u8)) + { + detailLevel = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DebugSetting(detailLevel, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DetailLevel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" detailLevel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DetailLevel)) + { + builder.Append(" detailLevel: "); + if (DetailLevel.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DetailLevel}'''"); + } + else + { + builder.AppendLine($"'{DetailLevel}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DebugSetting)} does not support writing '{options.Format}' format."); + } + } + + DebugSetting IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDebugSetting(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DebugSetting)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.cs new file mode 100644 index 000000000000..ab1c6c25b2f2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DebugSetting.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The debug setting. + internal partial class DebugSetting + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 DebugSetting() + { + } + + /// Initializes a new instance of . + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + /// Keeps track of any properties unknown to the library. + internal DebugSetting(string detailLevel, IDictionary serializedAdditionalRawData) + { + DetailLevel = detailLevel; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Specifies the type of information to log for debugging. The permitted values are none, requestContent, responseContent, or both requestContent and responseContent separated by a comma. The default is none. When setting this value, carefully consider the type of information you are passing in during deployment. By logging information about the request or response, you could potentially expose sensitive data that is retrieved through the deployment operations. + [WirePath("detailLevel")] + public string DetailLevel { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.Serialization.cs new file mode 100644 index 000000000000..03ddec12cc43 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.Serialization.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class DeploymentDiagnosticsDefinition : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DeploymentDiagnosticsDefinition)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("level"u8); + writer.WriteStringValue(Level.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (options.Format != "W") + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (options.Format != "W" && Optional.IsCollectionDefined(AdditionalInfo)) + { + writer.WritePropertyName("additionalInfo"u8); + writer.WriteStartArray(); + foreach (var item in AdditionalInfo) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeploymentDiagnosticsDefinition IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentDiagnosticsDefinition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentDiagnosticsDefinition(document.RootElement, options); + } + + internal static DeploymentDiagnosticsDefinition DeserializeDeploymentDiagnosticsDefinition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Level level = default; + string code = default; + string message = default; + string target = default; + IReadOnlyList additionalInfo = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("level"u8)) + { + level = new Level(property.Value.GetString()); + continue; + } + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("additionalInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ErrorAdditionalInfo.DeserializeErrorAdditionalInfo(item, options)); + } + additionalInfo = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeploymentDiagnosticsDefinition( + level, + code, + message, + target, + additionalInfo ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Level), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" level: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" level: "); + builder.AppendLine($"'{Level.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Target), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" target: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Target)) + { + builder.Append(" target: "); + if (Target.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Target}'''"); + } + else + { + builder.AppendLine($"'{Target}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AdditionalInfo), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" additionalInfo: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AdditionalInfo)) + { + if (AdditionalInfo.Any()) + { + builder.Append(" additionalInfo: "); + builder.AppendLine("["); + foreach (var item in AdditionalInfo) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " additionalInfo: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DeploymentDiagnosticsDefinition)} does not support writing '{options.Format}' format."); + } + } + + DeploymentDiagnosticsDefinition IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDeploymentDiagnosticsDefinition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeploymentDiagnosticsDefinition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.cs new file mode 100644 index 000000000000..c88a87b87008 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentDiagnosticsDefinition.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.Resources.Deployments.Models +{ + /// The DeploymentDiagnosticsDefinition. + public partial class DeploymentDiagnosticsDefinition + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Denotes the additional response level. + /// The error code. + /// The error message. + internal DeploymentDiagnosticsDefinition(Level level, string code, string message) + { + Level = level; + Code = code; + Message = message; + AdditionalInfo = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Denotes the additional response level. + /// The error code. + /// The error message. + /// The error target. + /// The error additional info. + /// Keeps track of any properties unknown to the library. + internal DeploymentDiagnosticsDefinition(Level level, string code, string message, string target, IReadOnlyList additionalInfo, IDictionary serializedAdditionalRawData) + { + Level = level; + Code = code; + Message = message; + Target = target; + AdditionalInfo = additionalInfo; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeploymentDiagnosticsDefinition() + { + } + + /// Denotes the additional response level. + [WirePath("level")] + public Level Level { get; } + /// The error code. + [WirePath("code")] + public string Code { get; } + /// The error message. + [WirePath("message")] + public string Message { get; } + /// The error target. + [WirePath("target")] + public string Target { get; } + /// The error additional info. + [WirePath("additionalInfo")] + public IReadOnlyList AdditionalInfo { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.Serialization.cs new file mode 100644 index 000000000000..6976ecb234e3 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) 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.Resources.Deployments.Models +{ + public partial class DeploymentIdentity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(DeploymentIdentity)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(IdentityType.ToString()); + if (Optional.IsCollectionDefined(UserAssignedIdentities)) + { + writer.WritePropertyName("userAssignedIdentities"u8); + writer.WriteStartObject(); + foreach (var item in UserAssignedIdentities) + { + writer.WritePropertyName(item.Key); + JsonSerializer.Serialize(writer, item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeploymentIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeploymentIdentity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeploymentIdentity(document.RootElement, options); + } + + internal static DeploymentIdentity DeserializeDeploymentIdentity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeploymentIdentityType type = default; + IDictionary userAssignedIdentities = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new DeploymentIdentityType(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 DeploymentIdentity(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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(DeploymentIdentity)} does not support writing '{options.Format}' format."); + } + } + + DeploymentIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDeploymentIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeploymentIdentity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.cs new file mode 100644 index 000000000000..004869eb8209 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentity.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 Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The Managed Identity configuration for a deployment. + public partial class DeploymentIdentity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 identity type. + public DeploymentIdentity(DeploymentIdentityType identityType) + { + IdentityType = identityType; + UserAssignedIdentities = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The identity type. + /// The set of user assigned identities associated with the resource. + /// Keeps track of any properties unknown to the library. + internal DeploymentIdentity(DeploymentIdentityType identityType, IDictionary userAssignedIdentities, IDictionary serializedAdditionalRawData) + { + IdentityType = identityType; + UserAssignedIdentities = userAssignedIdentities; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeploymentIdentity() + { + } + + /// The identity type. + [WirePath("type")] + public DeploymentIdentityType IdentityType { get; } + /// The set of user assigned identities associated with the resource. + [WirePath("userAssignedIdentities")] + public IDictionary UserAssignedIdentities { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentityType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentityType.cs new file mode 100644 index 000000000000..0bbed0cebc95 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/DeploymentIdentityType.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.Resources.Deployments.Models +{ + /// The identity type. + public readonly partial struct DeploymentIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeploymentIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string UserAssignedValue = "UserAssigned"; + + /// None. + public static DeploymentIdentityType None { get; } = new DeploymentIdentityType(NoneValue); + /// UserAssigned. + public static DeploymentIdentityType UserAssigned { get; } = new DeploymentIdentityType(UserAssignedValue); + /// Determines if two values are the same. + public static bool operator ==(DeploymentIdentityType left, DeploymentIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeploymentIdentityType left, DeploymentIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeploymentIdentityType(string value) => new DeploymentIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeploymentIdentityType other && Equals(other); + /// + public bool Equals(DeploymentIdentityType 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs new file mode 100644 index 000000000000..81900bbd8ee8 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ErrorAdditionalInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ErrorAdditionalInfo)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ErrorAdditionalInfoType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ErrorAdditionalInfoType); + } + if (options.Format != "W" && Optional.IsDefined(Info)) + { + writer.WritePropertyName("info"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Info); +#else + using (JsonDocument document = JsonDocument.Parse(Info, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorAdditionalInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorAdditionalInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorAdditionalInfo(document.RootElement, options); + } + + internal static ErrorAdditionalInfo DeserializeErrorAdditionalInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = default; + BinaryData info = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("info"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + info = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorAdditionalInfo(type, info, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ErrorAdditionalInfoType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ErrorAdditionalInfoType)) + { + builder.Append(" type: "); + if (ErrorAdditionalInfoType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ErrorAdditionalInfoType}'''"); + } + else + { + builder.AppendLine($"'{ErrorAdditionalInfoType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Info), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" info: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Info)) + { + builder.Append(" info: "); + builder.AppendLine($"'{Info.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorAdditionalInfo)} does not support writing '{options.Format}' format."); + } + } + + ErrorAdditionalInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeErrorAdditionalInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorAdditionalInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.cs new file mode 100644 index 000000000000..f4c4e2fe95db --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorAdditionalInfo.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.Resources.Deployments.Models +{ + /// The resource management error additional info. + public partial class ErrorAdditionalInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ErrorAdditionalInfo() + { + } + + /// Initializes a new instance of . + /// The additional info type. + /// The additional info. + /// Keeps track of any properties unknown to the library. + internal ErrorAdditionalInfo(string errorAdditionalInfoType, BinaryData info, IDictionary serializedAdditionalRawData) + { + ErrorAdditionalInfoType = errorAdditionalInfoType; + Info = info; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The additional info type. + [WirePath("type")] + public string ErrorAdditionalInfoType { get; } + /// + /// The additional info. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("info")] + public BinaryData Info { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.Serialization.cs new file mode 100644 index 000000000000..813ab1df300c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.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.Resources.Deployments.Models +{ + public partial class ErrorDeployment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ErrorDeployment)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(DeploymentType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DeploymentType.Value.ToSerialString()); + } + if (Optional.IsDefined(DeploymentName)) + { + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDeployment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDeployment(document.RootElement, options); + } + + internal static ErrorDeployment DeserializeErrorDeployment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ErrorDeploymentType? type = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToErrorDeploymentType(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorDeployment(type, deploymentName, 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ErrorDeployment)} does not support writing '{options.Format}' format."); + } + } + + ErrorDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeErrorDeployment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorDeployment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.cs new file mode 100644 index 000000000000..7d9125db6fd0 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeployment.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Deployment on error behavior. + public partial class ErrorDeployment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ErrorDeployment() + { + } + + /// Initializes a new instance of . + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + /// The deployment to be used on error case. + /// Keeps track of any properties unknown to the library. + internal ErrorDeployment(ErrorDeploymentType? deploymentType, string deploymentName, IDictionary serializedAdditionalRawData) + { + DeploymentType = deploymentType; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + [WirePath("type")] + public ErrorDeploymentType? DeploymentType { get; set; } + /// The deployment to be used on error case. + [WirePath("deploymentName")] + public string DeploymentName { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.Serialization.cs new file mode 100644 index 000000000000..2e54ba2e7cdc --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ErrorDeploymentExtended : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ErrorDeploymentExtended)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(DeploymentType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DeploymentType.Value.ToSerialString()); + } + if (Optional.IsDefined(DeploymentName)) + { + writer.WritePropertyName("deploymentName"u8); + writer.WriteStringValue(DeploymentName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorDeploymentExtended IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDeploymentExtended)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDeploymentExtended(document.RootElement, options); + } + + internal static ErrorDeploymentExtended DeserializeErrorDeploymentExtended(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string provisioningState = default; + ErrorDeploymentType? type = default; + string deploymentName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToErrorDeploymentType(); + continue; + } + if (property.NameEquals("deploymentName"u8)) + { + deploymentName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorDeploymentExtended(provisioningState, type, deploymentName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeploymentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeploymentType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{DeploymentType.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeploymentName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deploymentName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeploymentName)) + { + builder.Append(" deploymentName: "); + if (DeploymentName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DeploymentName}'''"); + } + else + { + builder.AppendLine($"'{DeploymentName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorDeploymentExtended)} does not support writing '{options.Format}' format."); + } + } + + ErrorDeploymentExtended IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeErrorDeploymentExtended(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorDeploymentExtended)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.cs new file mode 100644 index 000000000000..5d8fa40fb269 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentExtended.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.Resources.Deployments.Models +{ + /// Deployment on error behavior with additional details. + public partial class ErrorDeploymentExtended + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ErrorDeploymentExtended() + { + } + + /// Initializes a new instance of . + /// The state of the provisioning for the on error deployment. + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + /// The deployment to be used on error case. + /// Keeps track of any properties unknown to the library. + internal ErrorDeploymentExtended(string provisioningState, ErrorDeploymentType? deploymentType, string deploymentName, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + DeploymentType = deploymentType; + DeploymentName = deploymentName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The state of the provisioning for the on error deployment. + [WirePath("provisioningState")] + public string ProvisioningState { get; } + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + [WirePath("type")] + public ErrorDeploymentType? DeploymentType { get; } + /// The deployment to be used on error case. + [WirePath("deploymentName")] + public string DeploymentName { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.Serialization.cs new file mode 100644 index 000000000000..bad27c6f7aae --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class ErrorDeploymentTypeExtensions + { + public static string ToSerialString(this ErrorDeploymentType value) => value switch + { + ErrorDeploymentType.LastSuccessful => "LastSuccessful", + ErrorDeploymentType.SpecificDeployment => "SpecificDeployment", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ErrorDeploymentType value.") + }; + + public static ErrorDeploymentType ToErrorDeploymentType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "LastSuccessful")) return ErrorDeploymentType.LastSuccessful; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "SpecificDeployment")) return ErrorDeploymentType.SpecificDeployment; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ErrorDeploymentType value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.cs new file mode 100644 index 000000000000..f1ed18373547 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ErrorDeploymentType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The deployment on error behavior type. Possible values are LastSuccessful and SpecificDeployment. + public enum ErrorDeploymentType + { + /// LastSuccessful. + LastSuccessful, + /// SpecificDeployment. + SpecificDeployment + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.Serialization.cs new file mode 100644 index 000000000000..060662cb8b12 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.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.Resources.Deployments.Models +{ + internal partial class ExpressionEvaluationOptions : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ExpressionEvaluationOptions)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExpressionEvaluationOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpressionEvaluationOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpressionEvaluationOptions(document.RootElement, options); + } + + internal static ExpressionEvaluationOptions DeserializeExpressionEvaluationOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ExpressionEvaluationScope? scope = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scope = new ExpressionEvaluationScope(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpressionEvaluationOptions(scope, 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, AzureResourceManagerResourcesDeploymentsContext.Default); + default: + throw new FormatException($"The model {nameof(ExpressionEvaluationOptions)} does not support writing '{options.Format}' format."); + } + } + + ExpressionEvaluationOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExpressionEvaluationOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpressionEvaluationOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.cs new file mode 100644 index 000000000000..ea0263a6363c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationOptions.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Specifies whether template expressions are evaluated within the scope of the parent template or nested template. + internal partial class ExpressionEvaluationOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ExpressionEvaluationOptions() + { + } + + /// Initializes a new instance of . + /// The scope to be used for evaluation of parameters, variables and functions in a nested template. + /// Keeps track of any properties unknown to the library. + internal ExpressionEvaluationOptions(ExpressionEvaluationScope? scope, IDictionary serializedAdditionalRawData) + { + Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The scope to be used for evaluation of parameters, variables and functions in a nested template. + [WirePath("scope")] + public ExpressionEvaluationScope? Scope { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationScope.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationScope.cs new file mode 100644 index 000000000000..2b56d25b62cd --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExpressionEvaluationScope.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.Resources.Deployments.Models +{ + /// The scope to be used for evaluation of parameters, variables and functions in a nested template. + public readonly partial struct ExpressionEvaluationScope : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExpressionEvaluationScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string OuterValue = "Outer"; + private const string InnerValue = "Inner"; + + /// NotSpecified. + public static ExpressionEvaluationScope NotSpecified { get; } = new ExpressionEvaluationScope(NotSpecifiedValue); + /// Outer. + public static ExpressionEvaluationScope Outer { get; } = new ExpressionEvaluationScope(OuterValue); + /// Inner. + public static ExpressionEvaluationScope Inner { get; } = new ExpressionEvaluationScope(InnerValue); + /// Determines if two values are the same. + public static bool operator ==(ExpressionEvaluationScope left, ExpressionEvaluationScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExpressionEvaluationScope left, ExpressionEvaluationScope right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ExpressionEvaluationScope(string value) => new ExpressionEvaluationScope(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExpressionEvaluationScope other && Equals(other); + /// + public bool Equals(ExpressionEvaluationScope 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExtensionConfigPropertyType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExtensionConfigPropertyType.cs new file mode 100644 index 000000000000..5acbadc0516a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ExtensionConfigPropertyType.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.Resources.Deployments.Models +{ + /// The ExtensionConfigPropertyType. + public readonly partial struct ExtensionConfigPropertyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ExtensionConfigPropertyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StringValue = "String"; + private const string IntValue = "Int"; + private const string BoolValue = "Bool"; + private const string ArrayValue = "Array"; + private const string ObjectValue = "Object"; + private const string SecureStringValue = "SecureString"; + private const string SecureObjectValue = "SecureObject"; + + /// Property type representing a string value. + public static ExtensionConfigPropertyType String { get; } = new ExtensionConfigPropertyType(StringValue); + /// Property type representing an integer value. + public static ExtensionConfigPropertyType Int { get; } = new ExtensionConfigPropertyType(IntValue); + /// Property type representing a boolean value. + public static ExtensionConfigPropertyType Bool { get; } = new ExtensionConfigPropertyType(BoolValue); + /// Property type representing an array value. + public static ExtensionConfigPropertyType Array { get; } = new ExtensionConfigPropertyType(ArrayValue); + /// Property type representing an object value. + public static ExtensionConfigPropertyType Object { get; } = new ExtensionConfigPropertyType(ObjectValue); + /// Property type representing a secure string value. + public static ExtensionConfigPropertyType SecureString { get; } = new ExtensionConfigPropertyType(SecureStringValue); + /// Property type representing a secure object value. + public static ExtensionConfigPropertyType SecureObject { get; } = new ExtensionConfigPropertyType(SecureObjectValue); + /// Determines if two values are the same. + public static bool operator ==(ExtensionConfigPropertyType left, ExtensionConfigPropertyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ExtensionConfigPropertyType left, ExtensionConfigPropertyType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ExtensionConfigPropertyType(string value) => new ExtensionConfigPropertyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ExtensionConfigPropertyType other && Equals(other); + /// + public bool Equals(ExtensionConfigPropertyType 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.Serialization.cs new file mode 100644 index 000000000000..512ae89e7477 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal partial class HttpMessage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(HttpMessage)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Content); +#else + using (JsonDocument document = JsonDocument.Parse(Content, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + HttpMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HttpMessage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHttpMessage(document.RootElement, options); + } + + internal static HttpMessage DeserializeHttpMessage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData content = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HttpMessage(content, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Content), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" content: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Content)) + { + builder.Append(" content: "); + builder.AppendLine($"'{Content.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(HttpMessage)} does not support writing '{options.Format}' format."); + } + } + + HttpMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeHttpMessage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HttpMessage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.cs new file mode 100644 index 000000000000..7902be6b8c59 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/HttpMessage.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; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// HTTP message. + internal partial class HttpMessage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 HttpMessage() + { + } + + /// Initializes a new instance of . + /// HTTP message content. + /// Keeps track of any properties unknown to the library. + internal HttpMessage(BinaryData content, IDictionary serializedAdditionalRawData) + { + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// HTTP message content. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("content")] + public BinaryData Content { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.Serialization.cs new file mode 100644 index 000000000000..20b95b26bd20 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.Serialization.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class KeyVaultParameterReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(KeyVaultParameterReference)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("keyVault"u8); + JsonSerializer.Serialize(writer, KeyVault); + writer.WritePropertyName("secretName"u8); + writer.WriteStringValue(SecretName); + if (Optional.IsDefined(SecretVersion)) + { + writer.WritePropertyName("secretVersion"u8); + writer.WriteStringValue(SecretVersion); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyVaultParameterReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyVaultParameterReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultParameterReference(document.RootElement, options); + } + + internal static KeyVaultParameterReference DeserializeKeyVaultParameterReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WritableSubResource keyVault = default; + string secretName = default; + string secretVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyVault"u8)) + { + keyVault = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("secretName"u8)) + { + secretName = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretVersion"u8)) + { + secretVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyVaultParameterReference(keyVault, secretName, secretVersion, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("KeyVaultId", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keyVault: "); + builder.AppendLine("{"); + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(KeyVault)) + { + builder.Append(" keyVault: "); + BicepSerializationHelpers.AppendChildObject(builder, KeyVault, options, 2, false, " keyVault: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secretName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecretName)) + { + builder.Append(" secretName: "); + if (SecretName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecretName}'''"); + } + else + { + builder.AppendLine($"'{SecretName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secretVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecretVersion)) + { + builder.Append(" secretVersion: "); + if (SecretVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecretVersion}'''"); + } + else + { + builder.AppendLine($"'{SecretVersion}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(KeyVaultParameterReference)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultParameterReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeKeyVaultParameterReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultParameterReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.cs new file mode 100644 index 000000000000..2be847794140 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/KeyVaultParameterReference.cs @@ -0,0 +1,103 @@ +// 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.Resources.Models; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Azure Key Vault parameter reference. + public partial class KeyVaultParameterReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Azure Key Vault reference. + /// Azure Key Vault secret name. + /// or is null. + public KeyVaultParameterReference(WritableSubResource keyVault, string secretName) + { + Argument.AssertNotNull(keyVault, nameof(keyVault)); + Argument.AssertNotNull(secretName, nameof(secretName)); + + KeyVault = keyVault; + SecretName = secretName; + } + + /// Initializes a new instance of . + /// Azure Key Vault reference. + /// Azure Key Vault secret name. + /// Azure Key Vault secret version. + /// Keeps track of any properties unknown to the library. + internal KeyVaultParameterReference(WritableSubResource keyVault, string secretName, string secretVersion, IDictionary serializedAdditionalRawData) + { + KeyVault = keyVault; + SecretName = secretName; + SecretVersion = secretVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultParameterReference() + { + } + + /// Azure Key Vault reference. + internal WritableSubResource KeyVault { get; set; } + /// Gets or sets Id. + [WirePath("keyVault.id")] + public ResourceIdentifier KeyVaultId + { + get => KeyVault is null ? default : KeyVault.Id; + set + { + if (KeyVault is null) + KeyVault = new WritableSubResource(); + KeyVault.Id = value; + } + } + + /// Azure Key Vault secret name. + [WirePath("secretName")] + public string SecretName { get; set; } + /// Azure Key Vault secret version. + [WirePath("secretVersion")] + public string SecretVersion { get; set; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Level.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Level.cs new file mode 100644 index 000000000000..01890aaf6255 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Level.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Denotes the additional response level. + public readonly partial struct Level : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Level(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string WarningValue = "Warning"; + private const string InfoValue = "Info"; + private const string ErrorValue = "Error"; + + /// Warning. + public static Level Warning { get; } = new Level(WarningValue); + /// Info. + public static Level Info { get; } = new Level(InfoValue); + /// Error. + public static Level Error { get; } = new Level(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(Level left, Level right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Level left, Level right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Level(string value) => new Level(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Level other && Equals(other); + /// + public bool Equals(Level other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.Serialization.cs new file mode 100644 index 000000000000..9559370c7939 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.Serialization.cs @@ -0,0 +1,358 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class Provider : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(Provider)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Namespace)) + { + writer.WritePropertyName("namespace"u8); + writer.WriteStringValue(Namespace); + } + if (options.Format != "W" && Optional.IsDefined(RegistrationState)) + { + writer.WritePropertyName("registrationState"u8); + writer.WriteStringValue(RegistrationState); + } + if (options.Format != "W" && Optional.IsDefined(RegistrationPolicy)) + { + writer.WritePropertyName("registrationPolicy"u8); + writer.WriteStringValue(RegistrationPolicy); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ResourceTypes)) + { + writer.WritePropertyName("resourceTypes"u8); + writer.WriteStartArray(); + foreach (var item in ResourceTypes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ProviderAuthorizationConsentState)) + { + writer.WritePropertyName("providerAuthorizationConsentState"u8); + writer.WriteStringValue(ProviderAuthorizationConsentState.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Provider IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Provider)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProvider(document.RootElement, options); + } + + internal static Provider DeserializeProvider(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string @namespace = default; + string registrationState = default; + string registrationPolicy = default; + IReadOnlyList resourceTypes = default; + ProviderAuthorizationConsentState? providerAuthorizationConsentState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("namespace"u8)) + { + @namespace = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationState"u8)) + { + registrationState = property.Value.GetString(); + continue; + } + if (property.NameEquals("registrationPolicy"u8)) + { + registrationPolicy = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProviderResourceType.DeserializeProviderResourceType(item, options)); + } + resourceTypes = array; + continue; + } + if (property.NameEquals("providerAuthorizationConsentState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + providerAuthorizationConsentState = new ProviderAuthorizationConsentState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Provider( + id, + @namespace, + registrationState, + registrationPolicy, + resourceTypes ?? new ChangeTrackingList(), + providerAuthorizationConsentState, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Namespace), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" namespace: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Namespace)) + { + builder.Append(" namespace: "); + if (Namespace.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Namespace}'''"); + } + else + { + builder.AppendLine($"'{Namespace}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RegistrationState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" registrationState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RegistrationState)) + { + builder.Append(" registrationState: "); + if (RegistrationState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RegistrationState}'''"); + } + else + { + builder.AppendLine($"'{RegistrationState}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RegistrationPolicy), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" registrationPolicy: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RegistrationPolicy)) + { + builder.Append(" registrationPolicy: "); + if (RegistrationPolicy.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{RegistrationPolicy}'''"); + } + else + { + builder.AppendLine($"'{RegistrationPolicy}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceTypes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceTypes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ResourceTypes)) + { + if (ResourceTypes.Any()) + { + builder.Append(" resourceTypes: "); + builder.AppendLine("["); + foreach (var item in ResourceTypes) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " resourceTypes: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProviderAuthorizationConsentState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" providerAuthorizationConsentState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProviderAuthorizationConsentState)) + { + builder.Append(" providerAuthorizationConsentState: "); + builder.AppendLine($"'{ProviderAuthorizationConsentState.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Provider)} does not support writing '{options.Format}' format."); + } + } + + Provider IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProvider(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Provider)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.cs new file mode 100644 index 000000000000..bb18d798ba68 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/Provider.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.Resources.Deployments.Models +{ + /// Resource provider information. + public partial class Provider + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 Provider() + { + ResourceTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The provider ID. + /// The namespace of the resource provider. + /// The registration state of the resource provider. + /// The registration policy of the resource provider. + /// The collection of provider resource types. + /// The provider authorization consent state. + /// Keeps track of any properties unknown to the library. + internal Provider(string id, string @namespace, string registrationState, string registrationPolicy, IReadOnlyList resourceTypes, ProviderAuthorizationConsentState? providerAuthorizationConsentState, IDictionary serializedAdditionalRawData) + { + Id = id; + Namespace = @namespace; + RegistrationState = registrationState; + RegistrationPolicy = registrationPolicy; + ResourceTypes = resourceTypes; + ProviderAuthorizationConsentState = providerAuthorizationConsentState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The provider ID. + [WirePath("id")] + public string Id { get; } + /// The namespace of the resource provider. + [WirePath("namespace")] + public string Namespace { get; } + /// The registration state of the resource provider. + [WirePath("registrationState")] + public string RegistrationState { get; } + /// The registration policy of the resource provider. + [WirePath("registrationPolicy")] + public string RegistrationPolicy { get; } + /// The collection of provider resource types. + [WirePath("resourceTypes")] + public IReadOnlyList ResourceTypes { get; } + /// The provider authorization consent state. + [WirePath("providerAuthorizationConsentState")] + public ProviderAuthorizationConsentState? ProviderAuthorizationConsentState { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderAuthorizationConsentState.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderAuthorizationConsentState.cs new file mode 100644 index 000000000000..c5b46fba9eef --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderAuthorizationConsentState.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.Resources.Deployments.Models +{ + /// The provider authorization consent state. + public readonly partial struct ProviderAuthorizationConsentState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProviderAuthorizationConsentState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string RequiredValue = "Required"; + private const string NotRequiredValue = "NotRequired"; + private const string ConsentedValue = "Consented"; + + /// NotSpecified. + public static ProviderAuthorizationConsentState NotSpecified { get; } = new ProviderAuthorizationConsentState(NotSpecifiedValue); + /// Required. + public static ProviderAuthorizationConsentState Required { get; } = new ProviderAuthorizationConsentState(RequiredValue); + /// NotRequired. + public static ProviderAuthorizationConsentState NotRequired { get; } = new ProviderAuthorizationConsentState(NotRequiredValue); + /// Consented. + public static ProviderAuthorizationConsentState Consented { get; } = new ProviderAuthorizationConsentState(ConsentedValue); + /// Determines if two values are the same. + public static bool operator ==(ProviderAuthorizationConsentState left, ProviderAuthorizationConsentState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProviderAuthorizationConsentState left, ProviderAuthorizationConsentState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProviderAuthorizationConsentState(string value) => new ProviderAuthorizationConsentState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProviderAuthorizationConsentState other && Equals(other); + /// + public bool Equals(ProviderAuthorizationConsentState 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.Serialization.cs new file mode 100644 index 000000000000..9731cc30180e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.Serialization.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ProviderExtendedLocation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ProviderExtendedLocation)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsDefined(ProviderExtendedLocationType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ProviderExtendedLocationType); + } + if (Optional.IsCollectionDefined(ExtendedLocations)) + { + writer.WritePropertyName("extendedLocations"u8); + writer.WriteStartArray(); + foreach (var item in ExtendedLocations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProviderExtendedLocation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProviderExtendedLocation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProviderExtendedLocation(document.RootElement, options); + } + + internal static ProviderExtendedLocation DeserializeProviderExtendedLocation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + string type = default; + IReadOnlyList extendedLocations = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("extendedLocations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + extendedLocations = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProviderExtendedLocation(location, type, extendedLocations ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProviderExtendedLocationType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProviderExtendedLocationType)) + { + builder.Append(" type: "); + if (ProviderExtendedLocationType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProviderExtendedLocationType}'''"); + } + else + { + builder.AppendLine($"'{ProviderExtendedLocationType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExtendedLocations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extendedLocations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ExtendedLocations)) + { + if (ExtendedLocations.Any()) + { + builder.Append(" extendedLocations: "); + builder.AppendLine("["); + foreach (var item in ExtendedLocations) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ProviderExtendedLocation)} does not support writing '{options.Format}' format."); + } + } + + ProviderExtendedLocation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProviderExtendedLocation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProviderExtendedLocation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.cs new file mode 100644 index 000000000000..0a777dbb7290 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderExtendedLocation.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.Resources.Deployments.Models +{ + /// The provider extended location. + public partial class ProviderExtendedLocation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ProviderExtendedLocation() + { + ExtendedLocations = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The azure location. + /// The extended location type. + /// The extended locations for the azure location. + /// Keeps track of any properties unknown to the library. + internal ProviderExtendedLocation(AzureLocation? location, string providerExtendedLocationType, IReadOnlyList extendedLocations, IDictionary serializedAdditionalRawData) + { + Location = location; + ProviderExtendedLocationType = providerExtendedLocationType; + ExtendedLocations = extendedLocations; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The azure location. + [WirePath("location")] + public AzureLocation? Location { get; } + /// The extended location type. + [WirePath("type")] + public string ProviderExtendedLocationType { get; } + /// The extended locations for the azure location. + [WirePath("extendedLocations")] + public IReadOnlyList ExtendedLocations { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.Serialization.cs new file mode 100644 index 000000000000..1572808f32ec --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.Serialization.cs @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ProviderResourceType : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ProviderResourceType)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType); + } + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(LocationMappings)) + { + writer.WritePropertyName("locationMappings"u8); + writer.WriteStartArray(); + foreach (var item in LocationMappings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Aliases)) + { + writer.WritePropertyName("aliases"u8); + writer.WriteStartArray(); + foreach (var item in Aliases) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ApiVersions)) + { + writer.WritePropertyName("apiVersions"u8); + writer.WriteStartArray(); + foreach (var item in ApiVersions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(DefaultApiVersion)) + { + writer.WritePropertyName("defaultApiVersion"u8); + writer.WriteStringValue(DefaultApiVersion); + } + if (Optional.IsCollectionDefined(ZoneMappings)) + { + writer.WritePropertyName("zoneMappings"u8); + writer.WriteStartArray(); + foreach (var item in ZoneMappings) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ApiProfiles)) + { + writer.WritePropertyName("apiProfiles"u8); + writer.WriteStartArray(); + foreach (var item in ApiProfiles) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Capabilities)) + { + writer.WritePropertyName("capabilities"u8); + writer.WriteStringValue(Capabilities); + } + if (Optional.IsCollectionDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + foreach (var item in Properties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ProviderResourceType IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ProviderResourceType)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeProviderResourceType(document.RootElement, options); + } + + internal static ProviderResourceType DeserializeProviderResourceType(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceType = default; + IReadOnlyList locations = default; + IReadOnlyList locationMappings = default; + IReadOnlyList aliases = default; + IReadOnlyList apiVersions = default; + string defaultApiVersion = default; + IReadOnlyList zoneMappings = default; + IReadOnlyList apiProfiles = default; + string capabilities = default; + IReadOnlyDictionary properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceType"u8)) + { + resourceType = property.Value.GetString(); + continue; + } + if (property.NameEquals("locations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + locations = array; + continue; + } + if (property.NameEquals("locationMappings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ProviderExtendedLocation.DeserializeProviderExtendedLocation(item, options)); + } + locationMappings = array; + continue; + } + if (property.NameEquals("aliases"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceTypeAlias.DeserializeResourceTypeAlias(item, options)); + } + aliases = array; + continue; + } + if (property.NameEquals("apiVersions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + apiVersions = array; + continue; + } + if (property.NameEquals("defaultApiVersion"u8)) + { + defaultApiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("zoneMappings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ZoneMapping.DeserializeZoneMapping(item, options)); + } + zoneMappings = array; + continue; + } + if (property.NameEquals("apiProfiles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ApiProfile.DeserializeApiProfile(item, options)); + } + apiProfiles = array; + continue; + } + if (property.NameEquals("capabilities"u8)) + { + capabilities = property.Value.GetString(); + continue; + } + if (property.NameEquals("properties"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()); + } + properties = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ProviderResourceType( + resourceType, + locations ?? new ChangeTrackingList(), + locationMappings ?? new ChangeTrackingList(), + aliases ?? new ChangeTrackingList(), + apiVersions ?? new ChangeTrackingList(), + defaultApiVersion, + zoneMappings ?? new ChangeTrackingList(), + apiProfiles ?? new ChangeTrackingList(), + capabilities, + properties ?? new ChangeTrackingDictionary(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + if (ResourceType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceType}'''"); + } + else + { + builder.AppendLine($"'{ResourceType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Locations), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" locations: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Locations)) + { + if (Locations.Any()) + { + builder.Append(" locations: "); + builder.AppendLine("["); + foreach (var item in Locations) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LocationMappings), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" locationMappings: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(LocationMappings)) + { + if (LocationMappings.Any()) + { + builder.Append(" locationMappings: "); + builder.AppendLine("["); + foreach (var item in LocationMappings) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " locationMappings: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Aliases), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" aliases: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Aliases)) + { + if (Aliases.Any()) + { + builder.Append(" aliases: "); + builder.AppendLine("["); + foreach (var item in Aliases) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " aliases: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiVersions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiVersions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ApiVersions)) + { + if (ApiVersions.Any()) + { + builder.Append(" apiVersions: "); + builder.AppendLine("["); + foreach (var item in ApiVersions) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultApiVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultApiVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultApiVersion)) + { + builder.Append(" defaultApiVersion: "); + if (DefaultApiVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DefaultApiVersion}'''"); + } + else + { + builder.AppendLine($"'{DefaultApiVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ZoneMappings), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zoneMappings: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ZoneMappings)) + { + if (ZoneMappings.Any()) + { + builder.Append(" zoneMappings: "); + builder.AppendLine("["); + foreach (var item in ZoneMappings) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " zoneMappings: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiProfiles), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiProfiles: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ApiProfiles)) + { + if (ApiProfiles.Any()) + { + builder.Append(" apiProfiles: "); + builder.AppendLine("["); + foreach (var item in ApiProfiles) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " apiProfiles: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Capabilities), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" capabilities: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Capabilities)) + { + builder.Append(" capabilities: "); + if (Capabilities.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Capabilities}'''"); + } + else + { + builder.AppendLine($"'{Capabilities}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Properties)) + { + if (Properties.Any()) + { + builder.Append(" properties: "); + builder.AppendLine("{"); + foreach (var item in Properties) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ProviderResourceType)} does not support writing '{options.Format}' format."); + } + } + + ProviderResourceType IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeProviderResourceType(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ProviderResourceType)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.cs new file mode 100644 index 000000000000..1b908aafb7f5 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProviderResourceType.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Resource type managed by the resource provider. + public partial class ProviderResourceType + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ProviderResourceType() + { + Locations = new ChangeTrackingList(); + LocationMappings = new ChangeTrackingList(); + Aliases = new ChangeTrackingList(); + ApiVersions = new ChangeTrackingList(); + ZoneMappings = new ChangeTrackingList(); + ApiProfiles = new ChangeTrackingList(); + Properties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The resource type. + /// The collection of locations where this resource type can be created. + /// The location mappings that are supported by this resource type. + /// The aliases that are supported by this resource type. + /// The API version. + /// The default API version. + /// + /// The API profiles for the resource provider. + /// The additional capabilities offered by this resource type. + /// The properties. + /// Keeps track of any properties unknown to the library. + internal ProviderResourceType(string resourceType, IReadOnlyList locations, IReadOnlyList locationMappings, IReadOnlyList aliases, IReadOnlyList apiVersions, string defaultApiVersion, IReadOnlyList zoneMappings, IReadOnlyList apiProfiles, string capabilities, IReadOnlyDictionary properties, IDictionary serializedAdditionalRawData) + { + ResourceType = resourceType; + Locations = locations; + LocationMappings = locationMappings; + Aliases = aliases; + ApiVersions = apiVersions; + DefaultApiVersion = defaultApiVersion; + ZoneMappings = zoneMappings; + ApiProfiles = apiProfiles; + Capabilities = capabilities; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource type. + [WirePath("resourceType")] + public string ResourceType { get; } + /// The collection of locations where this resource type can be created. + [WirePath("locations")] + public IReadOnlyList Locations { get; } + /// The location mappings that are supported by this resource type. + [WirePath("locationMappings")] + public IReadOnlyList LocationMappings { get; } + /// The aliases that are supported by this resource type. + [WirePath("aliases")] + public IReadOnlyList Aliases { get; } + /// The API version. + [WirePath("apiVersions")] + public IReadOnlyList ApiVersions { get; } + /// The default API version. + [WirePath("defaultApiVersion")] + public string DefaultApiVersion { get; } + /// Gets the zone mappings. + [WirePath("zoneMappings")] + public IReadOnlyList ZoneMappings { get; } + /// The API profiles for the resource provider. + [WirePath("apiProfiles")] + public IReadOnlyList ApiProfiles { get; } + /// The additional capabilities offered by this resource type. + [WirePath("capabilities")] + public string Capabilities { get; } + /// The properties. + [WirePath("properties")] + public IReadOnlyDictionary Properties { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.Serialization.cs new file mode 100644 index 000000000000..2d8298d27e8d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class ProvisioningOperationKindExtensions + { + public static string ToSerialString(this ProvisioningOperationKind value) => value switch + { + ProvisioningOperationKind.NotSpecified => "NotSpecified", + ProvisioningOperationKind.Create => "Create", + ProvisioningOperationKind.Delete => "Delete", + ProvisioningOperationKind.Waiting => "Waiting", + ProvisioningOperationKind.AzureAsyncOperationWaiting => "AzureAsyncOperationWaiting", + ProvisioningOperationKind.ResourceCacheWaiting => "ResourceCacheWaiting", + ProvisioningOperationKind.Action => "Action", + ProvisioningOperationKind.Read => "Read", + ProvisioningOperationKind.EvaluateDeploymentOutput => "EvaluateDeploymentOutput", + ProvisioningOperationKind.DeploymentCleanup => "DeploymentCleanup", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningOperationKind value.") + }; + + public static ProvisioningOperationKind ToProvisioningOperationKind(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NotSpecified")) return ProvisioningOperationKind.NotSpecified; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Create")) return ProvisioningOperationKind.Create; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Delete")) return ProvisioningOperationKind.Delete; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Waiting")) return ProvisioningOperationKind.Waiting; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "AzureAsyncOperationWaiting")) return ProvisioningOperationKind.AzureAsyncOperationWaiting; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "ResourceCacheWaiting")) return ProvisioningOperationKind.ResourceCacheWaiting; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Action")) return ProvisioningOperationKind.Action; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Read")) return ProvisioningOperationKind.Read; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "EvaluateDeploymentOutput")) return ProvisioningOperationKind.EvaluateDeploymentOutput; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "DeploymentCleanup")) return ProvisioningOperationKind.DeploymentCleanup; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ProvisioningOperationKind value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.cs new file mode 100644 index 000000000000..8ebdd3719de7 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ProvisioningOperationKind.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The name of the current provisioning operation. + public enum ProvisioningOperationKind + { + /// The provisioning operation is not specified. + NotSpecified, + /// The provisioning operation is create. + Create, + /// The provisioning operation is delete. + Delete, + /// The provisioning operation is waiting. + Waiting, + /// The provisioning operation is waiting Azure async operation. + AzureAsyncOperationWaiting, + /// The provisioning operation is waiting for resource cache. + ResourceCacheWaiting, + /// The provisioning operation is action. + Action, + /// The provisioning operation is read. + Read, + /// The provisioning operation is evaluate output. + EvaluateDeploymentOutput, + /// The provisioning operation is cleanup. This operation is part of the 'complete' mode deployment. + DeploymentCleanup + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.Serialization.cs new file mode 100644 index 000000000000..98aa1810f6d2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.Serialization.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ResourceTypeAlias : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ResourceTypeAlias)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Paths)) + { + writer.WritePropertyName("paths"u8); + writer.WriteStartArray(); + foreach (var item in Paths) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AliasType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(AliasType.Value.ToSerialString()); + } + if (Optional.IsDefined(DefaultPath)) + { + writer.WritePropertyName("defaultPath"u8); + writer.WriteStringValue(DefaultPath); + } + if (Optional.IsDefined(DefaultPattern)) + { + writer.WritePropertyName("defaultPattern"u8); + writer.WriteObjectValue(DefaultPattern, options); + } + if (options.Format != "W" && Optional.IsDefined(DefaultMetadata)) + { + writer.WritePropertyName("defaultMetadata"u8); + writer.WriteObjectValue(DefaultMetadata, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceTypeAlias IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceTypeAlias)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceTypeAlias(document.RootElement, options); + } + + internal static ResourceTypeAlias DeserializeResourceTypeAlias(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList paths = default; + ResourceTypeAliasType? type = default; + string defaultPath = default; + ResourceTypeAliasPattern defaultPattern = default; + ResourceTypeAliasPathMetadata defaultMetadata = 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("paths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceTypeAliasPath.DeserializeResourceTypeAliasPath(item, options)); + } + paths = array; + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToResourceTypeAliasType(); + continue; + } + if (property.NameEquals("defaultPath"u8)) + { + defaultPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("defaultPattern"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultPattern = ResourceTypeAliasPattern.DeserializeResourceTypeAliasPattern(property.Value, options); + continue; + } + if (property.NameEquals("defaultMetadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + defaultMetadata = ResourceTypeAliasPathMetadata.DeserializeResourceTypeAliasPathMetadata(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceTypeAlias( + name, + paths ?? new ChangeTrackingList(), + type, + defaultPath, + defaultPattern, + defaultMetadata, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Paths), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" paths: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Paths)) + { + if (Paths.Any()) + { + builder.Append(" paths: "); + builder.AppendLine("["); + foreach (var item in Paths) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " paths: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AliasType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AliasType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{AliasType.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultPath), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultPath: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultPath)) + { + builder.Append(" defaultPath: "); + if (DefaultPath.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DefaultPath}'''"); + } + else + { + builder.AppendLine($"'{DefaultPath}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultPattern), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultPattern: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultPattern)) + { + builder.Append(" defaultPattern: "); + BicepSerializationHelpers.AppendChildObject(builder, DefaultPattern, options, 2, false, " defaultPattern: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DefaultMetadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" defaultMetadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DefaultMetadata)) + { + builder.Append(" defaultMetadata: "); + BicepSerializationHelpers.AppendChildObject(builder, DefaultMetadata, options, 2, false, " defaultMetadata: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceTypeAlias)} does not support writing '{options.Format}' format."); + } + } + + ResourceTypeAlias IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceTypeAlias(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceTypeAlias)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.cs new file mode 100644 index 000000000000..12c33cefc094 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAlias.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.Resources.Deployments.Models +{ + /// The alias type. + public partial class ResourceTypeAlias + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ResourceTypeAlias() + { + Paths = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The alias name. + /// The paths for an alias. + /// The type of the alias. + /// The default path for an alias. + /// The default pattern for an alias. + /// The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata. + /// Keeps track of any properties unknown to the library. + internal ResourceTypeAlias(string name, IReadOnlyList paths, ResourceTypeAliasType? aliasType, string defaultPath, ResourceTypeAliasPattern defaultPattern, ResourceTypeAliasPathMetadata defaultMetadata, IDictionary serializedAdditionalRawData) + { + Name = name; + Paths = paths; + AliasType = aliasType; + DefaultPath = defaultPath; + DefaultPattern = defaultPattern; + DefaultMetadata = defaultMetadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The alias name. + [WirePath("name")] + public string Name { get; } + /// The paths for an alias. + [WirePath("paths")] + public IReadOnlyList Paths { get; } + /// The type of the alias. + [WirePath("type")] + public ResourceTypeAliasType? AliasType { get; } + /// The default path for an alias. + [WirePath("defaultPath")] + public string DefaultPath { get; } + /// The default pattern for an alias. + [WirePath("defaultPattern")] + public ResourceTypeAliasPattern DefaultPattern { get; } + /// The default alias path metadata. Applies to the default path and to any alias path that doesn't have metadata. + [WirePath("defaultMetadata")] + public ResourceTypeAliasPathMetadata DefaultMetadata { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.Serialization.cs new file mode 100644 index 000000000000..4ce3d09f374c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.Serialization.cs @@ -0,0 +1,292 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ResourceTypeAliasPath : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ResourceTypeAliasPath)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsCollectionDefined(ApiVersions)) + { + writer.WritePropertyName("apiVersions"u8); + writer.WriteStartArray(); + foreach (var item in ApiVersions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Pattern)) + { + writer.WritePropertyName("pattern"u8); + writer.WriteObjectValue(Pattern, options); + } + if (options.Format != "W" && Optional.IsDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteObjectValue(Metadata, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceTypeAliasPath IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceTypeAliasPath)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceTypeAliasPath(document.RootElement, options); + } + + internal static ResourceTypeAliasPath DeserializeResourceTypeAliasPath(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + IReadOnlyList apiVersions = default; + ResourceTypeAliasPattern pattern = default; + ResourceTypeAliasPathMetadata metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("apiVersions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + apiVersions = array; + continue; + } + if (property.NameEquals("pattern"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + pattern = ResourceTypeAliasPattern.DeserializeResourceTypeAliasPattern(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = ResourceTypeAliasPathMetadata.DeserializeResourceTypeAliasPathMetadata(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceTypeAliasPath(path, apiVersions ?? new ChangeTrackingList(), pattern, metadata, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Path), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" path: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Path)) + { + builder.Append(" path: "); + if (Path.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Path}'''"); + } + else + { + builder.AppendLine($"'{Path}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiVersions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiVersions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ApiVersions)) + { + if (ApiVersions.Any()) + { + builder.Append(" apiVersions: "); + builder.AppendLine("["); + foreach (var item in ApiVersions) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Pattern), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" pattern: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Pattern)) + { + builder.Append(" pattern: "); + BicepSerializationHelpers.AppendChildObject(builder, Pattern, options, 2, false, " pattern: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Metadata)) + { + builder.Append(" metadata: "); + BicepSerializationHelpers.AppendChildObject(builder, Metadata, options, 2, false, " metadata: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPath)} does not support writing '{options.Format}' format."); + } + } + + ResourceTypeAliasPath IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceTypeAliasPath(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPath)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.cs new file mode 100644 index 000000000000..57f52394b72c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPath.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.Resources.Deployments.Models +{ + /// The type of the paths for alias. + public partial class ResourceTypeAliasPath + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ResourceTypeAliasPath() + { + ApiVersions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The path of an alias. + /// The API versions. + /// The pattern for an alias path. + /// The metadata of the alias path. If missing, fall back to the default metadata of the alias. + /// Keeps track of any properties unknown to the library. + internal ResourceTypeAliasPath(string path, IReadOnlyList apiVersions, ResourceTypeAliasPattern pattern, ResourceTypeAliasPathMetadata metadata, IDictionary serializedAdditionalRawData) + { + Path = path; + ApiVersions = apiVersions; + Pattern = pattern; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The path of an alias. + [WirePath("path")] + public string Path { get; } + /// The API versions. + [WirePath("apiVersions")] + public IReadOnlyList ApiVersions { get; } + /// The pattern for an alias path. + [WirePath("pattern")] + public ResourceTypeAliasPattern Pattern { get; } + /// The metadata of the alias path. If missing, fall back to the default metadata of the alias. + [WirePath("metadata")] + public ResourceTypeAliasPathMetadata Metadata { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathAttribute.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathAttribute.cs new file mode 100644 index 000000000000..5fd2536129b2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathAttribute.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.Resources.Deployments.Models +{ + /// The attributes of the token that the alias path is referring to. + public readonly partial struct ResourceTypeAliasPathAttribute : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceTypeAliasPathAttribute(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string ModifiableValue = "Modifiable"; + + /// The token that the alias path is referring to has no attributes. + public static ResourceTypeAliasPathAttribute None { get; } = new ResourceTypeAliasPathAttribute(NoneValue); + /// The token that the alias path is referring to is modifiable by policies with 'modify' effect. + public static ResourceTypeAliasPathAttribute Modifiable { get; } = new ResourceTypeAliasPathAttribute(ModifiableValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceTypeAliasPathAttribute left, ResourceTypeAliasPathAttribute right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceTypeAliasPathAttribute left, ResourceTypeAliasPathAttribute right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceTypeAliasPathAttribute(string value) => new ResourceTypeAliasPathAttribute(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceTypeAliasPathAttribute other && Equals(other); + /// + public bool Equals(ResourceTypeAliasPathAttribute 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.Serialization.cs new file mode 100644 index 000000000000..5d329b7ead33 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ResourceTypeAliasPathMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ResourceTypeAliasPathMetadata)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(TokenType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TokenType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStringValue(Attributes.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceTypeAliasPathMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceTypeAliasPathMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceTypeAliasPathMetadata(document.RootElement, options); + } + + internal static ResourceTypeAliasPathMetadata DeserializeResourceTypeAliasPathMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceTypeAliasPathTokenType? type = default; + ResourceTypeAliasPathAttribute? attributes = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new ResourceTypeAliasPathTokenType(property.Value.GetString()); + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + attributes = new ResourceTypeAliasPathAttribute(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceTypeAliasPathMetadata(type, attributes, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TokenType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TokenType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{TokenType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Attributes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" attributes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Attributes)) + { + builder.Append(" attributes: "); + builder.AppendLine($"'{Attributes.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPathMetadata)} does not support writing '{options.Format}' format."); + } + } + + ResourceTypeAliasPathMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceTypeAliasPathMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPathMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.cs new file mode 100644 index 000000000000..aca499193b1c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathMetadata.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The ResourceTypeAliasPathMetadata. + public partial class ResourceTypeAliasPathMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ResourceTypeAliasPathMetadata() + { + } + + /// Initializes a new instance of . + /// The type of the token that the alias path is referring to. + /// The attributes of the token that the alias path is referring to. + /// Keeps track of any properties unknown to the library. + internal ResourceTypeAliasPathMetadata(ResourceTypeAliasPathTokenType? tokenType, ResourceTypeAliasPathAttribute? attributes, IDictionary serializedAdditionalRawData) + { + TokenType = tokenType; + Attributes = attributes; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of the token that the alias path is referring to. + [WirePath("type")] + public ResourceTypeAliasPathTokenType? TokenType { get; } + /// The attributes of the token that the alias path is referring to. + [WirePath("attributes")] + public ResourceTypeAliasPathAttribute? Attributes { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathTokenType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathTokenType.cs new file mode 100644 index 000000000000..cb8d0a4aa580 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPathTokenType.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.Resources.Deployments.Models +{ + /// The type of the token that the alias path is referring to. + public readonly partial struct ResourceTypeAliasPathTokenType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceTypeAliasPathTokenType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string AnyValue = "Any"; + private const string StringValue = "String"; + private const string ObjectValue = "Object"; + private const string ArrayValue = "Array"; + private const string IntegerValue = "Integer"; + private const string NumberValue = "Number"; + private const string BooleanValue = "Boolean"; + + /// The token type is not specified. + public static ResourceTypeAliasPathTokenType NotSpecified { get; } = new ResourceTypeAliasPathTokenType(NotSpecifiedValue); + /// The token type can be anything. + public static ResourceTypeAliasPathTokenType Any { get; } = new ResourceTypeAliasPathTokenType(AnyValue); + /// The token type is string. + public static ResourceTypeAliasPathTokenType String { get; } = new ResourceTypeAliasPathTokenType(StringValue); + /// The token type is object. + public static ResourceTypeAliasPathTokenType Object { get; } = new ResourceTypeAliasPathTokenType(ObjectValue); + /// The token type is array. + public static ResourceTypeAliasPathTokenType Array { get; } = new ResourceTypeAliasPathTokenType(ArrayValue); + /// The token type is integer. + public static ResourceTypeAliasPathTokenType Integer { get; } = new ResourceTypeAliasPathTokenType(IntegerValue); + /// The token type is number. + public static ResourceTypeAliasPathTokenType Number { get; } = new ResourceTypeAliasPathTokenType(NumberValue); + /// The token type is boolean. + public static ResourceTypeAliasPathTokenType Boolean { get; } = new ResourceTypeAliasPathTokenType(BooleanValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceTypeAliasPathTokenType left, ResourceTypeAliasPathTokenType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceTypeAliasPathTokenType left, ResourceTypeAliasPathTokenType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceTypeAliasPathTokenType(string value) => new ResourceTypeAliasPathTokenType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceTypeAliasPathTokenType other && Equals(other); + /// + public bool Equals(ResourceTypeAliasPathTokenType 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.Serialization.cs new file mode 100644 index 000000000000..08ed0ea39ebc --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.Serialization.cs @@ -0,0 +1,234 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ResourceTypeAliasPattern : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ResourceTypeAliasPattern)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Phrase)) + { + writer.WritePropertyName("phrase"u8); + writer.WriteStringValue(Phrase); + } + if (Optional.IsDefined(Variable)) + { + writer.WritePropertyName("variable"u8); + writer.WriteStringValue(Variable); + } + if (Optional.IsDefined(PatternType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(PatternType.Value.ToSerialString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceTypeAliasPattern IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceTypeAliasPattern)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceTypeAliasPattern(document.RootElement, options); + } + + internal static ResourceTypeAliasPattern DeserializeResourceTypeAliasPattern(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string phrase = default; + string variable = default; + ResourceTypeAliasPatternType? type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("phrase"u8)) + { + phrase = property.Value.GetString(); + continue; + } + if (property.NameEquals("variable"u8)) + { + variable = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = property.Value.GetString().ToResourceTypeAliasPatternType(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceTypeAliasPattern(phrase, variable, type, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Phrase), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" phrase: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Phrase)) + { + builder.Append(" phrase: "); + if (Phrase.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Phrase}'''"); + } + else + { + builder.AppendLine($"'{Phrase}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Variable), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" variable: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Variable)) + { + builder.Append(" variable: "); + if (Variable.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Variable}'''"); + } + else + { + builder.AppendLine($"'{Variable}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PatternType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PatternType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{PatternType.Value.ToSerialString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPattern)} does not support writing '{options.Format}' format."); + } + } + + ResourceTypeAliasPattern IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceTypeAliasPattern(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceTypeAliasPattern)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.cs new file mode 100644 index 000000000000..c5facb2b61ef --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPattern.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.Resources.Deployments.Models +{ + /// The type of the pattern for an alias path. + public partial class ResourceTypeAliasPattern + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ResourceTypeAliasPattern() + { + } + + /// Initializes a new instance of . + /// The alias pattern phrase. + /// The alias pattern variable. + /// The type of alias pattern. + /// Keeps track of any properties unknown to the library. + internal ResourceTypeAliasPattern(string phrase, string variable, ResourceTypeAliasPatternType? patternType, IDictionary serializedAdditionalRawData) + { + Phrase = phrase; + Variable = variable; + PatternType = patternType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The alias pattern phrase. + [WirePath("phrase")] + public string Phrase { get; } + /// The alias pattern variable. + [WirePath("variable")] + public string Variable { get; } + /// The type of alias pattern. + [WirePath("type")] + public ResourceTypeAliasPatternType? PatternType { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.Serialization.cs new file mode 100644 index 000000000000..dcc24a1d1fac --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class ResourceTypeAliasPatternTypeExtensions + { + public static string ToSerialString(this ResourceTypeAliasPatternType value) => value switch + { + ResourceTypeAliasPatternType.NotSpecified => "NotSpecified", + ResourceTypeAliasPatternType.Extract => "Extract", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceTypeAliasPatternType value.") + }; + + public static ResourceTypeAliasPatternType ToResourceTypeAliasPatternType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NotSpecified")) return ResourceTypeAliasPatternType.NotSpecified; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Extract")) return ResourceTypeAliasPatternType.Extract; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceTypeAliasPatternType value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.cs new file mode 100644 index 000000000000..d6e83c785833 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasPatternType.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The type of alias pattern. + public enum ResourceTypeAliasPatternType + { + /// NotSpecified is not allowed. + NotSpecified, + /// Extract is the only allowed value. + Extract + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.Serialization.cs new file mode 100644 index 000000000000..c01f737283b8 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.Serialization.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class ResourceTypeAliasTypeExtensions + { + public static string ToSerialString(this ResourceTypeAliasType value) => value switch + { + ResourceTypeAliasType.NotSpecified => "NotSpecified", + ResourceTypeAliasType.PlainText => "PlainText", + ResourceTypeAliasType.Mask => "Mask", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceTypeAliasType value.") + }; + + public static ResourceTypeAliasType ToResourceTypeAliasType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NotSpecified")) return ResourceTypeAliasType.NotSpecified; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "PlainText")) return ResourceTypeAliasType.PlainText; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Mask")) return ResourceTypeAliasType.Mask; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown ResourceTypeAliasType value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.cs new file mode 100644 index 000000000000..2950da369c9a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourceTypeAliasType.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The type of the alias. + public enum ResourceTypeAliasType + { + /// Alias type is unknown (same as not providing alias type). + NotSpecified, + /// Alias value is not secret. + PlainText, + /// Alias value is secret. + Mask + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourcesProvisioningState.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourcesProvisioningState.cs new file mode 100644 index 000000000000..72fc01d5ad65 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ResourcesProvisioningState.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.Resources.Deployments.Models +{ + /// Denotes the state of provisioning. + public readonly partial struct ResourcesProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourcesProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string AcceptedValue = "Accepted"; + private const string RunningValue = "Running"; + private const string ReadyValue = "Ready"; + private const string CreatingValue = "Creating"; + private const string CreatedValue = "Created"; + private const string DeletingValue = "Deleting"; + private const string DeletedValue = "Deleted"; + private const string CanceledValue = "Canceled"; + private const string FailedValue = "Failed"; + private const string SucceededValue = "Succeeded"; + private const string UpdatingValue = "Updating"; + + /// NotSpecified. + public static ResourcesProvisioningState NotSpecified { get; } = new ResourcesProvisioningState(NotSpecifiedValue); + /// Accepted. + public static ResourcesProvisioningState Accepted { get; } = new ResourcesProvisioningState(AcceptedValue); + /// Running. + public static ResourcesProvisioningState Running { get; } = new ResourcesProvisioningState(RunningValue); + /// Ready. + public static ResourcesProvisioningState Ready { get; } = new ResourcesProvisioningState(ReadyValue); + /// Creating. + public static ResourcesProvisioningState Creating { get; } = new ResourcesProvisioningState(CreatingValue); + /// Created. + public static ResourcesProvisioningState Created { get; } = new ResourcesProvisioningState(CreatedValue); + /// Deleting. + public static ResourcesProvisioningState Deleting { get; } = new ResourcesProvisioningState(DeletingValue); + /// Deleted. + public static ResourcesProvisioningState Deleted { get; } = new ResourcesProvisioningState(DeletedValue); + /// Canceled. + public static ResourcesProvisioningState Canceled { get; } = new ResourcesProvisioningState(CanceledValue); + /// Failed. + public static ResourcesProvisioningState Failed { get; } = new ResourcesProvisioningState(FailedValue); + /// Succeeded. + public static ResourcesProvisioningState Succeeded { get; } = new ResourcesProvisioningState(SucceededValue); + /// Updating. + public static ResourcesProvisioningState Updating { get; } = new ResourcesProvisioningState(UpdatingValue); + /// Determines if two values are the same. + public static bool operator ==(ResourcesProvisioningState left, ResourcesProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourcesProvisioningState left, ResourcesProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourcesProvisioningState(string value) => new ResourcesProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourcesProvisioningState other && Equals(other); + /// + public bool Equals(ResourcesProvisioningState 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.Serialization.cs new file mode 100644 index 000000000000..5758092bc476 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.Serialization.cs @@ -0,0 +1,200 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class StatusMessage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(StatusMessage)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + StatusMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StatusMessage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStatusMessage(document.RootElement, options); + } + + internal static StatusMessage DeserializeStatusMessage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string status = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StatusMessage(status, error, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StatusMessage)} does not support writing '{options.Format}' format."); + } + } + + StatusMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStatusMessage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StatusMessage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.cs new file mode 100644 index 000000000000..85f2dc6a0a96 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/StatusMessage.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Operation status message object. + public partial class StatusMessage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 StatusMessage() + { + } + + /// Initializes a new instance of . + /// Status of the deployment operation. + /// The error reported by the operation. + /// Keeps track of any properties unknown to the library. + internal StatusMessage(string status, ResponseError error, IDictionary serializedAdditionalRawData) + { + Status = status; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Status of the deployment operation. + [WirePath("status")] + public string Status { get; } + /// The error reported by the operation. + [WirePath("error")] + public ResponseError Error { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.Serialization.cs new file mode 100644 index 000000000000..e460ccc9d531 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.Serialization.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class TargetResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(TargetResource)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(ResourceName)) + { + writer.WritePropertyName("resourceName"u8); + writer.WriteStringValue(ResourceName); + } + if (Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("resourceType"u8); + writer.WriteStringValue(ResourceType.Value); + } + if (Optional.IsDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteObjectValue(Extension, options); + } + if (Optional.IsDefined(Identifiers)) + { + writer.WritePropertyName("identifiers"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Identifiers); +#else + using (JsonDocument document = JsonDocument.Parse(Identifiers, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(ApiVersion)) + { + writer.WritePropertyName("apiVersion"u8); + writer.WriteStringValue(ApiVersion); + } + if (Optional.IsDefined(SymbolicName)) + { + writer.WritePropertyName("symbolicName"u8); + writer.WriteStringValue(SymbolicName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TargetResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TargetResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTargetResource(document.RootElement, options); + } + + internal static TargetResource DeserializeTargetResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string resourceName = default; + ResourceType? resourceType = default; + ArmDeploymentExtensionDefinition extension = default; + BinaryData identifiers = default; + string apiVersion = default; + string symbolicName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceName"u8)) + { + resourceName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resourceType = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extension = ArmDeploymentExtensionDefinition.DeserializeArmDeploymentExtensionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("identifiers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifiers = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("apiVersion"u8)) + { + apiVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("symbolicName"u8)) + { + symbolicName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TargetResource( + id, + resourceName, + resourceType, + extension, + identifiers, + apiVersion, + symbolicName, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceName)) + { + builder.Append(" resourceName: "); + if (ResourceName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceName}'''"); + } + else + { + builder.AppendLine($"'{ResourceName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + builder.AppendLine($"'{ResourceType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Extension), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extension: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Extension)) + { + builder.Append(" extension: "); + BicepSerializationHelpers.AppendChildObject(builder, Extension, options, 2, false, " extension: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identifiers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identifiers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identifiers)) + { + builder.Append(" identifiers: "); + builder.AppendLine($"'{Identifiers.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ApiVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" apiVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ApiVersion)) + { + builder.Append(" apiVersion: "); + if (ApiVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ApiVersion}'''"); + } + else + { + builder.AppendLine($"'{ApiVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SymbolicName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" symbolicName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SymbolicName)) + { + builder.Append(" symbolicName: "); + if (SymbolicName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SymbolicName}'''"); + } + else + { + builder.AppendLine($"'{SymbolicName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(TargetResource)} does not support writing '{options.Format}' format."); + } + } + + TargetResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTargetResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TargetResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.cs new file mode 100644 index 000000000000..05e87f221348 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TargetResource.cs @@ -0,0 +1,126 @@ +// 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.Resources.Deployments.Models +{ + /// Target resource. + public partial class TargetResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 TargetResource() + { + } + + /// Initializes a new instance of . + /// The Azure resource ID of the resource. + /// The name of the resource. + /// The type of the resource. + /// The extension the resource was deployed with. + /// The extensible resource identifiers. + /// The API version the resource was deployed with. + /// The symbolic name of the resource as defined in the deployment template. + /// Keeps track of any properties unknown to the library. + internal TargetResource(string id, string resourceName, ResourceType? resourceType, ArmDeploymentExtensionDefinition extension, BinaryData identifiers, string apiVersion, string symbolicName, IDictionary serializedAdditionalRawData) + { + Id = id; + ResourceName = resourceName; + ResourceType = resourceType; + Extension = extension; + Identifiers = identifiers; + ApiVersion = apiVersion; + SymbolicName = symbolicName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The Azure resource ID of the resource. + [WirePath("id")] + public string Id { get; } + /// The name of the resource. + [WirePath("resourceName")] + public string ResourceName { get; } + /// The type of the resource. + [WirePath("resourceType")] + public ResourceType? ResourceType { get; } + /// The extension the resource was deployed with. + [WirePath("extension")] + public ArmDeploymentExtensionDefinition Extension { get; } + /// + /// The extensible resource identifiers. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("identifiers")] + public BinaryData Identifiers { get; } + /// The API version the resource was deployed with. + [WirePath("apiVersion")] + public string ApiVersion { get; } + /// The symbolic name of the resource as defined in the deployment template. + [WirePath("symbolicName")] + public string SymbolicName { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.Serialization.cs new file mode 100644 index 000000000000..9dda1b89ccbb --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.Serialization.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class TemplateHashResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(TemplateHashResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MinifiedTemplate)) + { + writer.WritePropertyName("minifiedTemplate"u8); + writer.WriteStringValue(MinifiedTemplate); + } + if (Optional.IsDefined(TemplateHash)) + { + writer.WritePropertyName("templateHash"u8); + writer.WriteStringValue(TemplateHash); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + TemplateHashResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemplateHashResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemplateHashResult(document.RootElement, options); + } + + internal static TemplateHashResult DeserializeTemplateHashResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string minifiedTemplate = default; + string templateHash = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minifiedTemplate"u8)) + { + minifiedTemplate = property.Value.GetString(); + continue; + } + if (property.NameEquals("templateHash"u8)) + { + templateHash = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemplateHashResult(minifiedTemplate, templateHash, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinifiedTemplate), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" minifiedTemplate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MinifiedTemplate)) + { + builder.Append(" minifiedTemplate: "); + if (MinifiedTemplate.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MinifiedTemplate}'''"); + } + else + { + builder.AppendLine($"'{MinifiedTemplate}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TemplateHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" templateHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TemplateHash)) + { + builder.Append(" templateHash: "); + if (TemplateHash.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{TemplateHash}'''"); + } + else + { + builder.AppendLine($"'{TemplateHash}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(TemplateHashResult)} does not support writing '{options.Format}' format."); + } + } + + TemplateHashResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTemplateHashResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemplateHashResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.cs new file mode 100644 index 000000000000..e74204bee887 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/TemplateHashResult.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Result of the request to calculate template hash. It contains a string of minified template and its hash. + public partial class TemplateHashResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 TemplateHashResult() + { + } + + /// Initializes a new instance of . + /// The minified template string. + /// The template hash. + /// Keeps track of any properties unknown to the library. + internal TemplateHashResult(string minifiedTemplate, string templateHash, IDictionary serializedAdditionalRawData) + { + MinifiedTemplate = minifiedTemplate; + TemplateHash = templateHash; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The minified template string. + [WirePath("minifiedTemplate")] + public string MinifiedTemplate { get; } + /// The template hash. + [WirePath("templateHash")] + public string TemplateHash { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ValidationLevel.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ValidationLevel.cs new file mode 100644 index 000000000000..ae5de21c059a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ValidationLevel.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.Resources.Deployments.Models +{ + /// The level of validation performed on the deployment. + public readonly partial struct ValidationLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ValidationLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TemplateValue = "Template"; + private const string ProviderValue = "Provider"; + private const string ProviderNoRbacValue = "ProviderNoRbac"; + + /// Static analysis of the template is performed. + public static ValidationLevel Template { get; } = new ValidationLevel(TemplateValue); + /// Static analysis of the template is performed and resource declarations are sent to resource providers for semantic validation. Validates that the caller has RBAC write permissions on each resource. + public static ValidationLevel Provider { get; } = new ValidationLevel(ProviderValue); + /// Static analysis of the template is performed and resource declarations are sent to resource providers for semantic validation. Skips validating that the caller has RBAC write permissions on each resource. + public static ValidationLevel ProviderNoRbac { get; } = new ValidationLevel(ProviderNoRbacValue); + /// Determines if two values are the same. + public static bool operator ==(ValidationLevel left, ValidationLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ValidationLevel left, ValidationLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ValidationLevel(string value) => new ValidationLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ValidationLevel other && Equals(other); + /// + public bool Equals(ValidationLevel 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/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.Serialization.cs new file mode 100644 index 000000000000..aee3caceaa11 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.Serialization.cs @@ -0,0 +1,493 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class WhatIfChange : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(WhatIfChange)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(DeploymentId)) + { + writer.WritePropertyName("deploymentId"u8); + writer.WriteStringValue(DeploymentId); + } + if (Optional.IsDefined(SymbolicName)) + { + writer.WritePropertyName("symbolicName"u8); + writer.WriteStringValue(SymbolicName); + } + if (Optional.IsDefined(Identifiers)) + { + writer.WritePropertyName("identifiers"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Identifiers); +#else + using (JsonDocument document = JsonDocument.Parse(Identifiers, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(Extension)) + { + writer.WritePropertyName("extension"u8); + writer.WriteObjectValue(Extension, options); + } + writer.WritePropertyName("changeType"u8); + writer.WriteStringValue(ChangeType.ToSerialString()); + if (Optional.IsDefined(UnsupportedReason)) + { + writer.WritePropertyName("unsupportedReason"u8); + writer.WriteStringValue(UnsupportedReason); + } + if (Optional.IsDefined(Before)) + { + writer.WritePropertyName("before"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Before); +#else + using (JsonDocument document = JsonDocument.Parse(Before, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(After)) + { + writer.WritePropertyName("after"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(After); +#else + using (JsonDocument document = JsonDocument.Parse(After, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(Delta)) + { + writer.WritePropertyName("delta"u8); + writer.WriteStartArray(); + foreach (var item in Delta) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WhatIfChange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WhatIfChange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWhatIfChange(document.RootElement, options); + } + + internal static WhatIfChange DeserializeWhatIfChange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceId = default; + string deploymentId = default; + string symbolicName = default; + BinaryData identifiers = default; + ArmDeploymentExtensionDefinition extension = default; + WhatIfChangeType changeType = default; + string unsupportedReason = default; + BinaryData before = default; + BinaryData after = default; + IReadOnlyList delta = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("deploymentId"u8)) + { + deploymentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("symbolicName"u8)) + { + symbolicName = property.Value.GetString(); + continue; + } + if (property.NameEquals("identifiers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identifiers = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("extension"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extension = ArmDeploymentExtensionDefinition.DeserializeArmDeploymentExtensionDefinition(property.Value, options); + continue; + } + if (property.NameEquals("changeType"u8)) + { + changeType = property.Value.GetString().ToWhatIfChangeType(); + continue; + } + if (property.NameEquals("unsupportedReason"u8)) + { + unsupportedReason = property.Value.GetString(); + continue; + } + if (property.NameEquals("before"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + before = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("after"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + after = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("delta"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WhatIfPropertyChange.DeserializeWhatIfPropertyChange(item, options)); + } + delta = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WhatIfChange( + resourceId, + deploymentId, + symbolicName, + identifiers, + extension, + changeType, + unsupportedReason, + before, + after, + delta ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + if (ResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceId}'''"); + } + else + { + builder.AppendLine($"'{ResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeploymentId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deploymentId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeploymentId)) + { + builder.Append(" deploymentId: "); + if (DeploymentId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DeploymentId}'''"); + } + else + { + builder.AppendLine($"'{DeploymentId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SymbolicName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" symbolicName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SymbolicName)) + { + builder.Append(" symbolicName: "); + if (SymbolicName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SymbolicName}'''"); + } + else + { + builder.AppendLine($"'{SymbolicName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Identifiers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" identifiers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Identifiers)) + { + builder.Append(" identifiers: "); + builder.AppendLine($"'{Identifiers.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Extension), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extension: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Extension)) + { + builder.Append(" extension: "); + BicepSerializationHelpers.AppendChildObject(builder, Extension, options, 2, false, " extension: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ChangeType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" changeType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" changeType: "); + builder.AppendLine($"'{ChangeType.ToSerialString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UnsupportedReason), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" unsupportedReason: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UnsupportedReason)) + { + builder.Append(" unsupportedReason: "); + if (UnsupportedReason.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{UnsupportedReason}'''"); + } + else + { + builder.AppendLine($"'{UnsupportedReason}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Before), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" before: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Before)) + { + builder.Append(" before: "); + builder.AppendLine($"'{Before.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(After), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" after: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(After)) + { + builder.Append(" after: "); + builder.AppendLine($"'{After.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Delta), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" delta: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Delta)) + { + if (Delta.Any()) + { + builder.Append(" delta: "); + builder.AppendLine("["); + foreach (var item in Delta) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " delta: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(WhatIfChange)} does not support writing '{options.Format}' format."); + } + } + + WhatIfChange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWhatIfChange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WhatIfChange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.cs new file mode 100644 index 000000000000..690f14c1bc16 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChange.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Information about a single resource change predicted by What-If operation. + public partial class WhatIfChange + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Type of change that will be made to the resource when the deployment is executed. + internal WhatIfChange(WhatIfChangeType changeType) + { + ChangeType = changeType; + Delta = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Resource ID. + /// The resource id of the Deployment responsible for this change. + /// The symbolic name of the resource responsible for this change. + /// A subset of properties that uniquely identify a Bicep extensible resource because it lacks a resource id like an Azure resource has. + /// The extension the resource was deployed with. + /// Type of change that will be made to the resource when the deployment is executed. + /// The explanation about why the resource is unsupported by What-If. + /// The snapshot of the resource before the deployment is executed. + /// The predicted snapshot of the resource after the deployment is executed. + /// The predicted changes to resource properties. + /// Keeps track of any properties unknown to the library. + internal WhatIfChange(string resourceId, string deploymentId, string symbolicName, BinaryData identifiers, ArmDeploymentExtensionDefinition extension, WhatIfChangeType changeType, string unsupportedReason, BinaryData before, BinaryData after, IReadOnlyList delta, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + DeploymentId = deploymentId; + SymbolicName = symbolicName; + Identifiers = identifiers; + Extension = extension; + ChangeType = changeType; + UnsupportedReason = unsupportedReason; + Before = before; + After = after; + Delta = delta; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WhatIfChange() + { + } + + /// Resource ID. + [WirePath("resourceId")] + public string ResourceId { get; } + /// The resource id of the Deployment responsible for this change. + [WirePath("deploymentId")] + public string DeploymentId { get; } + /// The symbolic name of the resource responsible for this change. + [WirePath("symbolicName")] + public string SymbolicName { get; } + /// + /// A subset of properties that uniquely identify a Bicep extensible resource because it lacks a resource id like an Azure resource has. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("identifiers")] + public BinaryData Identifiers { get; } + /// The extension the resource was deployed with. + [WirePath("extension")] + public ArmDeploymentExtensionDefinition Extension { get; } + /// Type of change that will be made to the resource when the deployment is executed. + [WirePath("changeType")] + public WhatIfChangeType ChangeType { get; } + /// The explanation about why the resource is unsupported by What-If. + [WirePath("unsupportedReason")] + public string UnsupportedReason { get; } + /// + /// The snapshot of the resource before the deployment is executed. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("before")] + public BinaryData Before { get; } + /// + /// The predicted snapshot of the resource after the deployment is executed. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("after")] + public BinaryData After { get; } + /// The predicted changes to resource properties. + [WirePath("delta")] + public IReadOnlyList Delta { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.Serialization.cs new file mode 100644 index 000000000000..1eb301e6810c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class WhatIfChangeTypeExtensions + { + public static string ToSerialString(this WhatIfChangeType value) => value switch + { + WhatIfChangeType.Create => "Create", + WhatIfChangeType.Delete => "Delete", + WhatIfChangeType.Ignore => "Ignore", + WhatIfChangeType.Deploy => "Deploy", + WhatIfChangeType.NoChange => "NoChange", + WhatIfChangeType.Modify => "Modify", + WhatIfChangeType.Unsupported => "Unsupported", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfChangeType value.") + }; + + public static WhatIfChangeType ToWhatIfChangeType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Create")) return WhatIfChangeType.Create; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Delete")) return WhatIfChangeType.Delete; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Ignore")) return WhatIfChangeType.Ignore; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Deploy")) return WhatIfChangeType.Deploy; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NoChange")) return WhatIfChangeType.NoChange; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Modify")) return WhatIfChangeType.Modify; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Unsupported")) return WhatIfChangeType.Unsupported; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfChangeType value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.cs new file mode 100644 index 000000000000..05ef89aba3f2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfChangeType.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// Type of change that will be made to the resource when the deployment is executed. + public enum WhatIfChangeType + { + /// The resource does not exist in the current state but is present in the desired state. The resource will be created when the deployment is executed. + Create, + /// The resource exists in the current state and is missing from the desired state. The resource will be deleted when the deployment is executed. + Delete, + /// The resource exists in the current state and is missing from the desired state. The resource will not be deployed or modified when the deployment is executed. + Ignore, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource may or may not change. + Deploy, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will not change. + NoChange, + /// The resource exists in the current state and the desired state and will be redeployed when the deployment is executed. The properties of the resource will change. + Modify, + /// The resource is not supported by What-If. + Unsupported + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.Serialization.cs new file mode 100644 index 000000000000..b38026cedfb6 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.Serialization.cs @@ -0,0 +1,369 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class WhatIfOperationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(WhatIfOperationResult)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Changes)) + { + writer.WritePropertyName("changes"u8); + writer.WriteStartArray(); + foreach (var item in Changes) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(PotentialChanges)) + { + writer.WritePropertyName("potentialChanges"u8); + writer.WriteStartArray(); + foreach (var item in PotentialChanges) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Diagnostics)) + { + writer.WritePropertyName("diagnostics"u8); + writer.WriteStartArray(); + foreach (var item in Diagnostics) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WhatIfOperationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WhatIfOperationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWhatIfOperationResult(document.RootElement, options); + } + + internal static WhatIfOperationResult DeserializeWhatIfOperationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string status = default; + ResponseError error = default; + IReadOnlyList changes = default; + IReadOnlyList potentialChanges = default; + IReadOnlyList diagnostics = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("changes"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WhatIfChange.DeserializeWhatIfChange(item, options)); + } + changes = array; + continue; + } + if (property0.NameEquals("potentialChanges"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(WhatIfChange.DeserializeWhatIfChange(item, options)); + } + potentialChanges = array; + continue; + } + if (property0.NameEquals("diagnostics"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DeploymentDiagnosticsDefinition.DeserializeDeploymentDiagnosticsDefinition(item, options)); + } + diagnostics = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WhatIfOperationResult( + status, + error, + changes ?? new ChangeTrackingList(), + potentialChanges ?? new ChangeTrackingList(), + diagnostics ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + if (Status.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Status}'''"); + } + else + { + builder.AppendLine($"'{Status}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Changes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" changes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Changes)) + { + if (Changes.Any()) + { + builder.Append(" changes: "); + builder.AppendLine("["); + foreach (var item in Changes) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " changes: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PotentialChanges), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" potentialChanges: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(PotentialChanges)) + { + if (PotentialChanges.Any()) + { + builder.Append(" potentialChanges: "); + builder.AppendLine("["); + foreach (var item in PotentialChanges) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " potentialChanges: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Diagnostics), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" diagnostics: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Diagnostics)) + { + if (Diagnostics.Any()) + { + builder.Append(" diagnostics: "); + builder.AppendLine("["); + foreach (var item in Diagnostics) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " diagnostics: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(WhatIfOperationResult)} does not support writing '{options.Format}' format."); + } + } + + WhatIfOperationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWhatIfOperationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WhatIfOperationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.cs new file mode 100644 index 000000000000..791b40330859 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfOperationResult.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.Resources.Deployments.Models +{ + /// Result of the What-If operation. Contains a list of predicted changes and a URL link to get to the next set of results. + public partial class WhatIfOperationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 WhatIfOperationResult() + { + Changes = new ChangeTrackingList(); + PotentialChanges = new ChangeTrackingList(); + Diagnostics = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Status of the What-If operation. + /// Error when What-If operation fails. + /// List of resource changes predicted by What-If operation. + /// List of resource changes predicted by What-If operation. + /// List of resource diagnostics detected by What-If operation. + /// Keeps track of any properties unknown to the library. + internal WhatIfOperationResult(string status, ResponseError error, IReadOnlyList changes, IReadOnlyList potentialChanges, IReadOnlyList diagnostics, IDictionary serializedAdditionalRawData) + { + Status = status; + Error = error; + Changes = changes; + PotentialChanges = potentialChanges; + Diagnostics = diagnostics; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Status of the What-If operation. + [WirePath("status")] + public string Status { get; } + /// Error when What-If operation fails. + [WirePath("error")] + public ResponseError Error { get; } + /// List of resource changes predicted by What-If operation. + [WirePath("properties.changes")] + public IReadOnlyList Changes { get; } + /// List of resource changes predicted by What-If operation. + [WirePath("properties.potentialChanges")] + public IReadOnlyList PotentialChanges { get; } + /// List of resource diagnostics detected by What-If operation. + [WirePath("properties.diagnostics")] + public IReadOnlyList Diagnostics { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.Serialization.cs new file mode 100644 index 000000000000..e7ae251ca011 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.Serialization.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class WhatIfPropertyChange : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(WhatIfPropertyChange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + writer.WritePropertyName("propertyChangeType"u8); + writer.WriteStringValue(PropertyChangeType.ToSerialString()); + if (Optional.IsDefined(Before)) + { + writer.WritePropertyName("before"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Before); +#else + using (JsonDocument document = JsonDocument.Parse(Before, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(After)) + { + writer.WritePropertyName("after"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(After); +#else + using (JsonDocument document = JsonDocument.Parse(After, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(Children)) + { + writer.WritePropertyName("children"u8); + writer.WriteStartArray(); + foreach (var item in Children) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WhatIfPropertyChange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WhatIfPropertyChange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWhatIfPropertyChange(document.RootElement, options); + } + + internal static WhatIfPropertyChange DeserializeWhatIfPropertyChange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + WhatIfPropertyChangeType propertyChangeType = default; + BinaryData before = default; + BinaryData after = default; + IReadOnlyList children = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("propertyChangeType"u8)) + { + propertyChangeType = property.Value.GetString().ToWhatIfPropertyChangeType(); + continue; + } + if (property.NameEquals("before"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + before = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("after"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + after = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("children"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeWhatIfPropertyChange(item, options)); + } + children = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WhatIfPropertyChange( + path, + propertyChangeType, + before, + after, + children ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Path), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" path: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Path)) + { + builder.Append(" path: "); + if (Path.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Path}'''"); + } + else + { + builder.AppendLine($"'{Path}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PropertyChangeType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" propertyChangeType: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" propertyChangeType: "); + builder.AppendLine($"'{PropertyChangeType.ToSerialString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Before), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" before: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Before)) + { + builder.Append(" before: "); + builder.AppendLine($"'{Before.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(After), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" after: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(After)) + { + builder.Append(" after: "); + builder.AppendLine($"'{After.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Children), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" children: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Children)) + { + if (Children.Any()) + { + builder.Append(" children: "); + builder.AppendLine("["); + foreach (var item in Children) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " children: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(WhatIfPropertyChange)} does not support writing '{options.Format}' format."); + } + } + + WhatIfPropertyChange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWhatIfPropertyChange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WhatIfPropertyChange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.cs new file mode 100644 index 000000000000..bf49ae09a4ca --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChange.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The predicted change to the resource property. + public partial class WhatIfPropertyChange + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 path of the property. + /// The type of property change. + /// is null. + internal WhatIfPropertyChange(string path, WhatIfPropertyChangeType propertyChangeType) + { + Argument.AssertNotNull(path, nameof(path)); + + Path = path; + PropertyChangeType = propertyChangeType; + Children = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The path of the property. + /// The type of property change. + /// The value of the property before the deployment is executed. + /// The value of the property after the deployment is executed. + /// Nested property changes. + /// Keeps track of any properties unknown to the library. + internal WhatIfPropertyChange(string path, WhatIfPropertyChangeType propertyChangeType, BinaryData before, BinaryData after, IReadOnlyList children, IDictionary serializedAdditionalRawData) + { + Path = path; + PropertyChangeType = propertyChangeType; + Before = before; + After = after; + Children = children; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WhatIfPropertyChange() + { + } + + /// The path of the property. + [WirePath("path")] + public string Path { get; } + /// The type of property change. + [WirePath("propertyChangeType")] + public WhatIfPropertyChangeType PropertyChangeType { get; } + /// + /// The value of the property before the deployment is executed. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("before")] + public BinaryData Before { get; } + /// + /// The value of the property after the deployment is executed. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("after")] + public BinaryData After { get; } + /// Nested property changes. + [WirePath("children")] + public IReadOnlyList Children { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.Serialization.cs new file mode 100644 index 000000000000..6688394d44a7 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class WhatIfPropertyChangeTypeExtensions + { + public static string ToSerialString(this WhatIfPropertyChangeType value) => value switch + { + WhatIfPropertyChangeType.Create => "Create", + WhatIfPropertyChangeType.Delete => "Delete", + WhatIfPropertyChangeType.Modify => "Modify", + WhatIfPropertyChangeType.Array => "Array", + WhatIfPropertyChangeType.NoEffect => "NoEffect", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfPropertyChangeType value.") + }; + + public static WhatIfPropertyChangeType ToWhatIfPropertyChangeType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Create")) return WhatIfPropertyChangeType.Create; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Delete")) return WhatIfPropertyChangeType.Delete; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Modify")) return WhatIfPropertyChangeType.Modify; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Array")) return WhatIfPropertyChangeType.Array; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NoEffect")) return WhatIfPropertyChangeType.NoEffect; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfPropertyChangeType value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.cs new file mode 100644 index 000000000000..7959549f3f2a --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfPropertyChangeType.cs @@ -0,0 +1,24 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The type of property change. + public enum WhatIfPropertyChangeType + { + /// The property does not exist in the current state but is present in the desired state. The property will be created when the deployment is executed. + Create, + /// The property exists in the current state and is missing from the desired state. It will be deleted when the deployment is executed. + Delete, + /// The property exists in both current and desired state and is different. The value of the property will change when the deployment is executed. + Modify, + /// The property is an array and contains nested changes. + Array, + /// The property will not be set or updated. + NoEffect + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.Serialization.cs new file mode 100644 index 000000000000..e4a112947a35 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + internal static partial class WhatIfResultFormatExtensions + { + public static string ToSerialString(this WhatIfResultFormat value) => value switch + { + WhatIfResultFormat.ResourceIdOnly => "ResourceIdOnly", + WhatIfResultFormat.FullResourcePayloads => "FullResourcePayloads", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfResultFormat value.") + }; + + public static WhatIfResultFormat ToWhatIfResultFormat(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "ResourceIdOnly")) return WhatIfResultFormat.ResourceIdOnly; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "FullResourcePayloads")) return WhatIfResultFormat.FullResourcePayloads; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown WhatIfResultFormat value."); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.cs new file mode 100644 index 000000000000..44bbb655e09d --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/WhatIfResultFormat.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The format of the What-If results. + public enum WhatIfResultFormat + { + /// ResourceIdOnly. + ResourceIdOnly, + /// FullResourcePayloads. + FullResourcePayloads + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.Serialization.cs new file mode 100644 index 000000000000..73b31499f14f --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.Serialization.cs @@ -0,0 +1,228 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + public partial class ZoneMapping : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.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(ZoneMapping)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location.Value); + } + if (Optional.IsCollectionDefined(Zones)) + { + writer.WritePropertyName("zones"u8); + writer.WriteStartArray(); + foreach (var item in Zones) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ZoneMapping IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ZoneMapping)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeZoneMapping(document.RootElement, options); + } + + internal static ZoneMapping DeserializeZoneMapping(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureLocation? location = default; + IReadOnlyList zones = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("zones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + zones = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ZoneMapping(location, zones ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Zones), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zones: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Zones)) + { + if (Zones.Any()) + { + builder.Append(" zones: "); + builder.AppendLine("["); + foreach (var item in Zones) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerResourcesDeploymentsContext.Default); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ZoneMapping)} does not support writing '{options.Format}' format."); + } + } + + ZoneMapping IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeZoneMapping(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ZoneMapping)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.cs new file mode 100644 index 000000000000..8926d01b570e --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/Models/ZoneMapping.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Resources.Deployments.Models +{ + /// The ZoneMapping. + public partial class ZoneMapping + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// 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 ZoneMapping() + { + Zones = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The location of the zone mapping. + /// + /// Keeps track of any properties unknown to the library. + internal ZoneMapping(AzureLocation? location, IReadOnlyList zones, IDictionary serializedAdditionalRawData) + { + Location = location; + Zones = zones; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The location of the zone mapping. + [WirePath("location")] + public AzureLocation? Location { get; } + /// Gets the zones. + [WirePath("zones")] + public IReadOnlyList Zones { get; } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ProviderConstants.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..4cf95f538f48 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/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.Resources.Deployments +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentRestOperations.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentRestOperations.cs new file mode 100644 index 000000000000..c9c352f1a8c8 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentRestOperations.cs @@ -0,0 +1,309 @@ +// 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.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal partial class DeploymentRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DeploymentRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DeploymentRestOperations(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-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetAtScopeRequestUri(string scope, string deploymentName, string operationId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateGetAtScopeRequest(string scope, string deploymentName, string operationId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations/", false); + uri.AppendPath(operationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAtScopeAsync(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetAtScopeRequest(scope, deploymentName, operationId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperation value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentOperation.DeserializeArmDeploymentOperation(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a deployments operation. + /// The resource scope. + /// The name of the deployment. + /// The ID of the operation to get. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetAtScope(string scope, string deploymentName, string operationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNullOrEmpty(operationId, nameof(operationId)); + + using var message = CreateGetAtScopeRequest(scope, deploymentName, operationId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperation value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentOperation.DeserializeArmDeploymentOperation(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAtScopeRequestUri(string scope, string deploymentName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateListAtScopeRequest(string scope, string deploymentName, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/operations", false); + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAtScopeAsync(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListAtScopeRequest(scope, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentOperationsListResult.DeserializeArmDeploymentOperationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all deployments operations for a deployment. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListAtScope(string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListAtScopeRequest(scope, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentOperationsListResult.DeserializeArmDeploymentOperationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAtScopeNextPageRequestUri(string nextLink, string scope, string deploymentName, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal Core.HttpMessage CreateListAtScopeNextPageRequest(string nextLink, string scope, string deploymentName, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAtScopeNextPageAsync(string nextLink, string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, deploymentName, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperationsListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentOperationsListResult.DeserializeArmDeploymentOperationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all deployments operations for a deployment. + /// The URL to the next page of results. + /// The resource scope. + /// The name of the deployment. + /// The number of results to return. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListAtScopeNextPage(string nextLink, string scope, string deploymentName, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, deploymentName, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentOperationsListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentOperationsListResult.DeserializeArmDeploymentOperationsListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentsRestOperations.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentsRestOperations.cs new file mode 100644 index 000000000000..fa3c0e19195f --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Generated/RestOperations/DeploymentsRestOperations.cs @@ -0,0 +1,1214 @@ +// 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.Resources.Deployments.Models; + +namespace Azure.ResourceManager.Resources.Deployments +{ + internal partial class DeploymentsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of DeploymentsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public DeploymentsRestOperations(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-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateDeleteAtScopeRequestUri(string scope, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateDeleteAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateDeleteAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// A template deployment that is currently running cannot be deleted. Deleting a template deployment removes the associated deployment operations. This is an asynchronous operation that returns a status of 202 until the template deployment is successfully deleted. The Location response header contains the URI that is used to obtain the status of the process. While the process is running, a call to the URI in the Location header returns a status of 202. When the process finishes, the URI in the Location header returns a status of 204 on success. If the asynchronous request failed, the URI in the Location header returns an error-level status code. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response DeleteAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateDeleteAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCheckExistenceAtScopeRequestUri(string scope, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateCheckExistenceAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CheckExistenceAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateCheckExistenceAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Checks whether the deployment exists. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CheckExistenceAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateCheckExistenceAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + case 404: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateAtScopeRequestUri(string scope, string deploymentName, ArmDeploymentContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateCreateOrUpdateAtScopeRequest(string scope, string deploymentName, ArmDeploymentContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAtScopeAsync(string scope, string deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// You can provide the template and parameters directly in the request or link to JSON files. + /// The resource scope. + /// The name of the deployment. + /// Additional parameters supplied to the operation. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response CreateOrUpdateAtScope(string scope, string deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateCreateOrUpdateAtScopeRequest(scope, deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetAtScopeRequestUri(string scope, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateGetAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateGetAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentData.DeserializeArmDeploymentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArmDeploymentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets a deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GetAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateGetAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentData.DeserializeArmDeploymentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ArmDeploymentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCancelAtScopeRequestUri(string scope, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateCancelAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CancelAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateCancelAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// You can cancel a deployment only if the provisioningState is Accepted or Running. After the deployment is canceled, the provisioningState is set to Canceled. Canceling a template deployment stops the currently running template deployment and leaves the resources partially deployed. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response CancelAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateCancelAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateValidateAtScopeRequestUri(string scope, string deploymentName, ArmDeploymentContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateValidateAtScopeRequest(string scope, string deploymentName, ArmDeploymentContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task ValidateAtScopeAsync(string scope, string deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateValidateAtScopeRequest(scope, deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 400: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Validates whether the specified template is syntactically correct and will be accepted by Azure Resource Manager.. + /// The resource scope. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response ValidateAtScope(string scope, string deploymentName, ArmDeploymentContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateValidateAtScopeRequest(scope, deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 400: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateExportTemplateAtScopeRequestUri(string scope, string deploymentName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateExportTemplateAtScopeRequest(string scope, string deploymentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/exportTemplate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ExportTemplateAtScopeAsync(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateExportTemplateAtScopeRequest(scope, deploymentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentExportResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentExportResult.DeserializeArmDeploymentExportResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Exports the template used for specified deployment. + /// The resource scope. + /// The name of the deployment. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ExportTemplateAtScope(string scope, string deploymentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + + using var message = CreateExportTemplateAtScopeRequest(scope, deploymentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentExportResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentExportResult.DeserializeArmDeploymentExportResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAtScopeRequestUri(string scope, string filter, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateListAtScopeRequest(string scope, string filter, int? top) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(scope, false); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (top != null) + { + uri.AppendQuery("$top", top.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// is null. + public async Task> ListAtScopeAsync(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListAtScopeRequest(scope, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentListResult.DeserializeArmDeploymentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the deployments at the given scope. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// is null. + public Response ListAtScope(string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListAtScopeRequest(scope, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentListResult.DeserializeArmDeploymentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateWhatIfAtTenantScopeRequestUri(string deploymentName, ArmDeploymentWhatIfContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateWhatIfAtTenantScopeRequest(string deploymentName, ArmDeploymentWhatIfContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the tenant group. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task WhatIfAtTenantScopeAsync(string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtTenantScopeRequest(deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the tenant group. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response WhatIfAtTenantScope(string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtTenantScopeRequest(deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateWhatIfAtManagementGroupScopeRequestUri(string groupId, string deploymentName, ArmDeploymentWhatIfContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateWhatIfAtManagementGroupScopeRequest(string groupId, string deploymentName, ArmDeploymentWhatIfContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Management/managementGroups/", false); + uri.AppendPath(groupId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the management group. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task WhatIfAtManagementGroupScopeAsync(string groupId, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtManagementGroupScopeRequest(groupId, deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the management group. + /// The management group ID. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response WhatIfAtManagementGroupScope(string groupId, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupId, nameof(groupId)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtManagementGroupScopeRequest(groupId, deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateWhatIfAtSubscriptionScopeRequestUri(string subscriptionId, string deploymentName, ArmDeploymentWhatIfContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateWhatIfAtSubscriptionScopeRequest(string subscriptionId, string deploymentName, ArmDeploymentWhatIfContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The Microsoft Azure subscription ID. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task WhatIfAtSubscriptionScopeAsync(string subscriptionId, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtSubscriptionScopeRequest(subscriptionId, deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the subscription. + /// The Microsoft Azure subscription ID. + /// The name of the deployment. + /// Parameters to What If. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response WhatIfAtSubscriptionScope(string subscriptionId, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfAtSubscriptionScopeRequest(subscriptionId, deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateWhatIfRequestUri(string subscriptionId, string resourceGroupName, string deploymentName, ArmDeploymentWhatIfContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateWhatIfRequest(string subscriptionId, string resourceGroupName, string deploymentName, ArmDeploymentWhatIfContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Resources/deployments/", false); + uri.AppendPath(deploymentName, true); + uri.AppendPath("/whatIf", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The Microsoft Azure subscription ID. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task WhatIfAsync(string subscriptionId, string resourceGroupName, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfRequest(subscriptionId, resourceGroupName, deploymentName, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns changes that will be made by the deployment if executed at the scope of the resource group. + /// The Microsoft Azure subscription ID. + /// The name of the resource group the template will be deployed to. The name is case insensitive. + /// The name of the deployment. + /// Parameters to validate. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response WhatIf(string subscriptionId, string resourceGroupName, string deploymentName, ArmDeploymentWhatIfContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(deploymentName, nameof(deploymentName)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateWhatIfRequest(subscriptionId, resourceGroupName, deploymentName, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCalculateTemplateHashRequestUri(BinaryData template) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Resources/calculateTemplateHash", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal Core.HttpMessage CreateCalculateTemplateHashRequest(BinaryData template) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Resources/calculateTemplateHash", 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(); +#if NET6_0_OR_GREATER + content.JsonWriter.WriteRawValue(template); +#else + using (JsonDocument document = JsonDocument.Parse(template, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(content.JsonWriter, document.RootElement); + } +#endif + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public async Task> CalculateTemplateHashAsync(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var message = CreateCalculateTemplateHashRequest(template); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + TemplateHashResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = TemplateHashResult.DeserializeTemplateHashResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Calculate the hash of the given template. + /// The template provided to calculate hash. + /// The cancellation token to use. + /// is null. + public Response CalculateTemplateHash(BinaryData template, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(template, nameof(template)); + + using var message = CreateCalculateTemplateHashRequest(template); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + TemplateHashResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = TemplateHashResult.DeserializeTemplateHashResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAtScopeNextPageRequestUri(string nextLink, string scope, string filter, int? top) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal Core.HttpMessage CreateListAtScopeNextPageRequest(string nextLink, string scope, string filter, int? top) + { + 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; + } + + /// Get all the deployments at the given scope. + /// The URL to the next page of results. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// or is null. + public async Task> ListAtScopeNextPageAsync(string nextLink, string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, filter, top); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = ArmDeploymentListResult.DeserializeArmDeploymentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get all the deployments at the given scope. + /// The URL to the next page of results. + /// The resource scope. + /// The filter to apply on the operation. For example, you can use $filter=provisioningState eq '{state}'. + /// The number of results to get. If null is passed, returns all deployments. + /// The cancellation token to use. + /// or is null. + public Response ListAtScopeNextPage(string nextLink, string scope, string filter = null, int? top = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(scope, nameof(scope)); + + using var message = CreateListAtScopeNextPageRequest(nextLink, scope, filter, top); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ArmDeploymentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = ArmDeploymentListResult.DeserializeArmDeploymentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/GlobalSuppressions.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/GlobalSuppressions.cs new file mode 100644 index 000000000000..c5005bb55436 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/GlobalSuppressions.cs @@ -0,0 +1,8 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Diagnostics.CodeAnalysis; + +[assembly: SuppressMessage("Naming", "AZC0031:Improper model name suffix", Justification = "Model name ends with 'Definition', suppression added to avoid renaming.", Scope = "type", Target = "~T:Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentExtensionDefinition")] +[assembly: SuppressMessage("Naming", "AZC0033:Improper model name suffix", Justification = "Model name ends with 'Operation', suppression added to avoid renaming.", Scope = "type", Target = "~T:Azure.ResourceManager.Resources.Deployments.Models.ArmDeploymentOperation")] +[assembly: SuppressMessage("Naming", "AZC0031:Improper model name suffix", Justification = "Model name ends with 'Definition', suppression added to avoid renaming.", Scope = "type", Target = "~T:Azure.ResourceManager.Resources.Deployments.Models.DeploymentDiagnosticsDefinition")] \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Properties/AssemblyInfo.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..168cd18cdb27 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Resources.Deployments")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.Resources.Deployments.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/autorest.md b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/autorest.md new file mode 100644 index 000000000000..5a4992b1f09c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/src/autorest.md @@ -0,0 +1,271 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +library-name: Resources.Deployments +namespace: Azure.ResourceManager.Resources.Deployments +require: https://github.com/Azure/azure-rest-api-specs/blob/30b7aff12bd945cc154ba66eeb1592507926331f/specification/resources/resource-manager/Microsoft.Resources/deployments/readme.md +title: DeploymentsClient +tag: package-2025-04 +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../tests/Generated + clear-output-folder: true +skip-csproj: true +model-namespace: true +public-clients: false +head-as-boolean: false +modelerfour: + lenient-model-deduplication: true +use-model-reader-writer: true +enable-bicep-serialization: true + +rename-mapping: + ArmDeploymentPropertiesExtended.outputResources: OutputResourceDetails + ArmDeploymentPropertiesExtended.validatedResources: ValidatedResourceDetails + ResourceReference: ArmResourceReference + DeploymentExtensionDefinition: ArmDeploymentExtensionDefinition + DeploymentExtensionConfigItem: ArmDeploymentExtensionConfigItem + DeploymentExternalInput: ArmDeploymentExternalInput + DeploymentExternalInputDefinition: ArmDeploymentExternalInputDefinition + +patch-initializer-customization: + ArmDeploymentContent: + Properties: 'new ArmDeploymentProperties(current.Properties.Mode.HasValue ? current.Properties.Mode.Value : ArmDeploymentMode.Incremental)' + +request-path-to-parent: + # setting these to the same parent will automatically merge these operations + /providers/Microsoft.Resources/deployments/{deploymentName}/whatIf: /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /subscriptions/{subscriptionId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf: /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf: /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} + /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf: /{scope}/providers/Microsoft.Resources/deployments/{deploymentName} +request-path-to-scope-resource-types: + /{scope}/providers/Microsoft.Resources/deployments/{deploymentName}: + - subscriptions + - resourceGroups + - managementGroups + - tenant + /{scope}/providers/Microsoft.Resources/deployments: + - subscriptions + - resourceGroups + - managementGroups + - tenant + +override-operation-name: + DeploymentOperations_ListAtScope: GetDeploymentOperations + DeploymentOperations_GetAtScope: GetDeploymentOperation + Deployments_CancelAtScope: Cancel + Deployments_ValidateAtScope: Validate + Deployments_ExportTemplateAtScope: ExportTemplate + Deployments_WhatIf: WhatIf + Deployments_WhatIfAtManagementGroupScope: WhatIf + Deployments_WhatIfAtSubscriptionScope: WhatIf + Deployments_WhatIfAtTenantScope: WhatIf + Deployments_CheckExistenceAtScope: CheckExistence + Deployments_CalculateTemplateHash: CalculateDeploymentTemplateHash + +operation-groups-to-omit: + Providers;ProviderResourceTypes;Resources;ResourceGroups;Tags;Subscriptions;Tenants + +format-by-name-rules: + 'tenantId': 'uuid' + 'etag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4 + Ipv6: IPv6 + Ipsec: IPsec + SSO: Sso + URI: Uri + Urls: Uris + +directive: + # Use AtScope methods to replace the following operations + # Keep the get method at each scope so that generator can know the possible values of container's parent + - remove-operation: Deployments_DeleteAtTenantScope + - remove-operation: Deployments_CheckExistenceAtTenantScope + - remove-operation: Deployments_CreateOrUpdateAtTenantScope + - remove-operation: Deployments_GetAtTenantScope + - remove-operation: Deployments_CancelAtTenantScope + - remove-operation: Deployments_ValidateAtTenantScope + - remove-operation: Deployments_ExportTemplateAtTenantScope + - remove-operation: Deployments_ListAtTenantScope + - remove-operation: Deployments_DeleteAtManagementGroupScope + - remove-operation: Deployments_CheckExistenceAtManagementGroupScope + - remove-operation: Deployments_CreateOrUpdateAtManagementGroupScope + - remove-operation: Deployments_GetAtManagementGroupScope + - remove-operation: Deployments_CancelAtManagementGroupScope + - remove-operation: Deployments_ValidateAtManagementGroupScope + - remove-operation: Deployments_ExportTemplateAtManagementGroupScope + - remove-operation: Deployments_ListAtManagementGroupScope + - remove-operation: Deployments_DeleteAtSubscriptionScope + - remove-operation: Deployments_CheckExistenceAtSubscriptionScope + - remove-operation: Deployments_CreateOrUpdateAtSubscriptionScope + - remove-operation: Deployments_GetAtSubscriptionScope + - remove-operation: Deployments_CancelAtSubscriptionScope + - remove-operation: Deployments_ValidateAtSubscriptionScope + - remove-operation: Deployments_ExportTemplateAtSubscriptionScope + - remove-operation: Deployments_ListAtSubscriptionScope + - remove-operation: Deployments_Delete + - remove-operation: Deployments_CheckExistence + - remove-operation: Deployments_CreateOrUpdate + - remove-operation: Deployments_Get + - remove-operation: Deployments_Cancel + - remove-operation: Deployments_Validate + - remove-operation: Deployments_ExportTemplate + - remove-operation: Deployments_ListByResourceGroup + - remove-operation: DeploymentOperations_GetAtTenantScope + - remove-operation: DeploymentOperations_ListAtTenantScope + - remove-operation: DeploymentOperations_GetAtManagementGroupScope + - remove-operation: DeploymentOperations_ListAtManagementGroupScope + - remove-operation: DeploymentOperations_GetAtSubscriptionScope + - remove-operation: DeploymentOperations_ListAtSubscriptionScope + - remove-operation: DeploymentOperations_Get + - remove-operation: DeploymentOperations_List + + - rename-operation: + from: ListOperations + to: Operations_ListOps + - from: deployments.json + where: $.definitions.DeploymentOperationProperties + transform: > + $.properties.statusMessage['x-nullable'] = true; + - from: deployments.json + where: $.definitions + transform: > + $.DeploymentProperties.properties.mode['x-ms-enum'].name = 'ArmDeploymentMode'; + $.DeploymentPropertiesExtended.properties.mode['x-ms-enum'].name = 'ArmDeploymentMode'; + $.DeploymentExtended['x-ms-client-name'] = 'ArmDeployment'; + $.Deployment['x-ms-client-name'] = 'ArmDeploymentContent'; + $.DeploymentExportResult['x-ms-client-name'] = 'ArmDeploymentExportResult'; + $.DeploymentExtendedFilter['x-ms-client-name'] = 'ArmDeploymentExtendedFilter'; + $.DeploymentListResult['x-ms-client-name'] = 'ArmDeploymentListResult'; + $.DeploymentOperation['x-ms-client-name'] = 'ArmDeploymentOperation'; + $.DeploymentOperationProperties['x-ms-client-name'] = 'ArmDeploymentOperationProperties'; + $.DeploymentOperationProperties.properties.provisioningOperation['x-ms-enum'].name = 'ProvisioningOperationKind'; + $.DeploymentOperationsListResult['x-ms-client-name'] = 'ArmDeploymentOperationsListResult'; + $.DeploymentValidateResult['x-ms-client-name'] = 'ArmDeploymentValidateResult'; + $.DeploymentWhatIf['x-ms-client-name'] = 'ArmDeploymentWhatIfContent'; + $.DeploymentWhatIfSettings['x-ms-client-name'] = 'ArmDeploymentWhatIfSettings'; + $.DeploymentWhatIfProperties['x-ms-client-name'] = 'ArmDeploymentWhatIfProperties'; + $.DeploymentProperties['x-ms-client-name'] = 'ArmDeploymentProperties'; + $.DeploymentPropertiesExtended['x-ms-client-name'] = 'ArmDeploymentPropertiesExtended'; + $.Dependency['x-ms-client-name'] = 'ArmDependency'; + $.BasicDependency['x-ms-client-name'] = 'BasicArmDependency'; + $.Dependency.properties.resourceType['x-ms-format'] = 'resource-type'; + $.BasicDependency.properties.resourceType['x-ms-format'] = 'resource-type'; + $.TargetResource.properties.resourceType['x-ms-format'] = 'resource-type'; + $.DeploymentPropertiesExtended.properties.provisioningState['x-ms-enum'].name = 'ResourcesProvisioningState'; + $.DeploymentPropertiesExtended.properties.duration['format'] = 'duration'; + $.DeploymentPropertiesExtended.properties.onErrorDeployment['x-ms-client-name'] = 'ErrorDeployment'; + $.DeploymentOperationProperties.properties.duration['format'] = 'duration'; + $.ExpressionEvaluationOptions.properties.scope['x-ms-enum']['name'] = 'ExpressionEvaluationScope'; + $.OnErrorDeployment['x-ms-client-name'] = 'ErrorDeployment'; + $.OnErrorDeployment.properties.type['x-ms-enum'].name = 'ErrorDeploymentType'; + $.OnErrorDeploymentExtended['x-ms-client-name'] = 'ErrorDeploymentExtended'; + $.OnErrorDeploymentExtended.properties.type['x-ms-enum'].name = 'ErrorDeploymentType'; + $.ParametersLink['x-ms-client-name'] = 'ArmDeploymentParametersLink'; + $.TemplateLink['x-ms-client-name'] = 'ArmDeploymentTemplateLink'; + $.WhatIfChange.properties.changeType['x-ms-enum'].name = 'WhatIfChangeType'; + $.WhatIfPropertyChange.properties.propertyChangeType['x-ms-enum'].name = 'WhatIfPropertyChangeType'; + $.ResourceReference.properties.id["x-ms-format"] = "arm-id"; + - from: deployments.json + where: $.paths['/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'].post.parameters[1].schema + transform: $['$ref'] = '#/definitions/DeploymentWhatIf' + - from: deployments.json + where: $.paths['/providers/Microsoft.Management/managementGroups/{groupId}/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'].post.parameters[2].schema + transform: $['$ref'] = '#/definitions/DeploymentWhatIf' + - from: deployments.json + where: $.definitions.DeploymentWhatIf.properties.location + transform: $['description'] = 'The location to store the deployment data, only required at the tenant and management group scope.' + - from: deployments.json + where: $.definitions.Alias + transform: + $['x-ms-client-name'] = 'ResourceTypeAlias'; + - from: deployments.json + where: $.definitions.AliasPath + transform: + $['x-ms-client-name'] = 'ResourceTypeAliasPath'; + - from: deployments.json + where: $.definitions.AliasPathMetadata.properties.attributes['x-ms-enum'] + transform: + $['name'] = 'ResourceTypeAliasPathAttributes'; + - from: deployments.json + where: $.definitions.AliasPathMetadata + transform: + $['x-ms-client-name'] = 'ResourceTypeAliasPathMetadata'; + - from: deployments.json + where: $.definitions.AliasPathMetadata.properties.type['x-ms-enum'] + transform: + $['name'] = 'ResourceTypeAliasPathTokenType'; + - from: deployments.json + where: $.definitions.AliasPattern + transform: + $['x-ms-client-name'] = 'ResourceTypeAliasPattern'; + - from: deployments.json + where: $.definitions.AliasPattern.properties.type['x-ms-enum'] + transform: + $['name'] = 'ResourceTypeAliasPatternType'; + - from: deployments.json + where: $.definitions.Alias.properties.type['x-ms-enum'] + transform: + $['name'] = 'ResourceTypeAliasType'; + - from: deployments.json + where: $.definitions.DeploymentProperties.properties.expressionEvaluationOptions + transform: > + $['x-ms-client-name'] = 'ExpressionEvaluation' + - from: deployments.json + where: $.definitions.DeploymentProperties.properties.onErrorDeployment + transform: > + $['x-ms-client-name'] = 'ErrorDeployment' + # Avoid breaking change + - from: deployments.json + where: $.definitions.DeploymentProperties + transform: + delete $.properties.parameters.additionalProperties + - from: deployments.json + where: $.paths['/providers/Microsoft.Resources/deployments/{deploymentName}/whatIf'].post + transform: > + $['x-ms-examples'] = { + "Predict template changes at tenant scope": { + "$ref": "./examples/PostDeploymentWhatIfOnTenant.json" + } + } +``` + +### Tag: package-resources-2022-04 + +These settings apply only when `--tag=package-resources-2022-04` is specified on the command line. + + +```yaml $(tag) == 'package-resources-2022-04' +input-file: + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2021-05-01/templateSpecs.json + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2020-10-01/deploymentScripts.json + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2025-04-01/resources.json + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Solutions/stable/2019-07-01/managedapplications.json + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2023-11-01/bicepClient.json# + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2024-03-01/deploymentStacks.json + - https://github.com/Azure/azure-rest-api-specs/blob/778b6f8c84f4d62e66f054e3876acff30e5bd4f9/specification/resources/resource-manager/Microsoft.Resources/stable/2024-08-01/dataBoundaries.json +``` diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Azure.ResourceManager.Resources.Deployments.Tests.csproj b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Azure.ResourceManager.Resources.Deployments.Tests.csproj new file mode 100644 index 000000000000..aaf3866b3c30 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Azure.ResourceManager.Resources.Deployments.Tests.csproj @@ -0,0 +1,13 @@ + + + + + + + Always + + + + + + diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestBase.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestBase.cs new file mode 100644 index 000000000000..cbca97a549ab --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestBase.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class DeploymentsManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected DeploymentsManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected DeploymentsManagementTestBase(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/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestEnvironment.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestEnvironment.cs new file mode 100644 index 000000000000..3853e8a4cde5 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/DeploymentsManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class DeploymentsManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentCollection.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentCollection.cs new file mode 100644 index 000000000000..1a06e3d2db17 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentCollection.cs @@ -0,0 +1,68 @@ +// 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.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Samples +{ + public partial class Sample_ArmDeploymentCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateDeploymentAtAGivenScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentAtScope.json + // this example is just showing the usage of "Deployments_CreateOrUpdateAtScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 scope = "providers/Microsoft.Management/managementGroups/my-management-group-id"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(scope); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ArmDeploymentResource + ArmDeploymentCollection collection = subscriptionResource.GetArmDeployments(); + + // invoke the operation + string deploymentName = "my-deployment"; + ArmDeploymentContent content = new ArmDeploymentContent(new ArmDeploymentProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }) + { + Location = new AzureLocation("eastus"), + Tags = +{ +["tagKey1"] = "tag-value-1", +["tagKey2"] = "tag-value-2" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, deploymentName, content); + ArmDeploymentResource 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 + ArmDeploymentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentResource.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentResource.cs new file mode 100644 index 000000000000..e51363589b29 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_ArmDeploymentResource.cs @@ -0,0 +1,249 @@ +// 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.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Samples +{ + public partial class Sample_ArmDeploymentResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreateDeploymentAtAGivenScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PutDeploymentAtScope.json + // this example is just showing the usage of "Deployments_CreateOrUpdateAtScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string scope = "providers/Microsoft.Management/managementGroups/my-management-group-id"; + string deploymentName = "my-deployment"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentContent content = new ArmDeploymentContent(new ArmDeploymentProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }) + { + Location = new AzureLocation("eastus"), + Tags = +{ +["tagKey1"] = "tag-value-1", +["tagKey2"] = "tag-value-2" +}, + }; + ArmOperation lro = await armDeployment.UpdateAsync(WaitUntil.Completed, content); + ArmDeploymentResource 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 + ArmDeploymentData 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 Validate_ValidatesATemplateAtScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PostDeploymentValidateOnScope.json + // this example is just showing the usage of "Deployments_ValidateAtScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string scope = "subscriptions/00000000-0000-0000-0000-000000000001/resourceGroups/my-resource-group"; + string deploymentName = "my-deployment"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentContent content = new ArmDeploymentContent(new ArmDeploymentProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + QueryString = "sv=2019-02-02&st=2019-04-29T22%3A18%3A26Z&se=2019-04-30T02%3A23%3A26Z&sr=b&sp=rw&sip=168.1.5.60-168.1.5.70&spr=https&sig=xxxxxxxx0xxxxxxxxxxxxx%2bxxxxxxxxxxxxxxxxxxxx%3d", + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }); + ArmOperation lro = await armDeployment.ValidateAsync(WaitUntil.Completed, content); + ArmDeploymentValidateResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task WhatIf_PredictTemplateChangesAtTenantScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PostDeploymentWhatIfOnTenant.json + // this example is just showing the usage of "Deployments_WhatIfAtTenantScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string scope = $"/"; + string deploymentName = "exampleDeploymentName"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentWhatIfContent content = new ArmDeploymentWhatIfContent(new ArmDeploymentWhatIfProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }) + { + Location = new AzureLocation("eastus"), + }; + ArmOperation lro = await armDeployment.WhatIfAsync(WaitUntil.Completed, content); + WhatIfOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task WhatIf_PredictTemplateChangesAtManagementGroupScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PostDeploymentWhatIfOnManagementGroup.json + // this example is just showing the usage of "Deployments_WhatIfAtManagementGroupScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string groupId = "myManagementGruop"; + string scope = $"/providers/Microsoft.Management/managementGroups/{groupId}"; + string deploymentName = "exampleDeploymentName"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentWhatIfContent content = new ArmDeploymentWhatIfContent(new ArmDeploymentWhatIfProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }) + { + Location = new AzureLocation("eastus"), + }; + ArmOperation lro = await armDeployment.WhatIfAsync(WaitUntil.Completed, content); + WhatIfOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task WhatIf_PredictTemplateChangesAtSubscriptionScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PostDeploymentWhatIfOnSubscription.json + // this example is just showing the usage of "Deployments_WhatIfAtSubscriptionScope" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string subscriptionId = "00000000-0000-0000-0000-000000000001"; + string scope = $"/subscriptions/{subscriptionId}"; + string deploymentName = "my-deployment"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentWhatIfContent content = new ArmDeploymentWhatIfContent(new ArmDeploymentWhatIfProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }) + { + Location = new AzureLocation("westus"), + }; + ArmOperation lro = await armDeployment.WhatIfAsync(WaitUntil.Completed, content); + WhatIfOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task WhatIf_PredictTemplateChangesAtResourceGroupScope() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/PostDeploymentWhatIfOnResourceGroup.json + // this example is just showing the usage of "Deployments_WhatIf" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmDeploymentResource created on azure + // for more information of creating ArmDeploymentResource, please refer to the document of ArmDeploymentResource + string subscriptionId = "00000000-0000-0000-0000-000000000001"; + string resourceGroupName = "my-resource-group"; + string scope = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}"; + string deploymentName = "my-deployment"; + ResourceIdentifier armDeploymentResourceId = ArmDeploymentResource.CreateResourceIdentifier(scope, deploymentName); + ArmDeploymentResource armDeployment = client.GetArmDeploymentResource(armDeploymentResourceId); + + // invoke the operation + ArmDeploymentWhatIfContent content = new ArmDeploymentWhatIfContent(new ArmDeploymentWhatIfProperties(ArmDeploymentMode.Incremental) + { + TemplateLink = new ArmDeploymentTemplateLink + { + Uri = new Uri("https://example.com/exampleTemplate.json"), + }, + Parameters = BinaryData.FromObjectAsJson(new object()), + }); + ArmOperation lro = await armDeployment.WhatIfAsync(WaitUntil.Completed, content); + WhatIfOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_TenantResourceExtensions.cs new file mode 100644 index 000000000000..a09bbb143d1b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Generated/Samples/Sample_TenantResourceExtensions.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; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Samples +{ + public partial class Sample_TenantResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CalculateDeploymentTemplateHash_CalculateTemplateHash() + { + // Generated from example definition: specification/resources/resource-manager/Microsoft.Resources/deployments/stable/2025-04-01/examples/CalculateTemplateHash.json + // this example is just showing the usage of "Deployments_CalculateTemplateHash" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + TenantResource tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // invoke the operation + BinaryData template = BinaryData.FromObjectAsJson(new Dictionary + { + ["$schema"] = "http://schemas.management.azure.com/deploymentTemplate?api-version=2014-04-01-preview", + ["contentVersion"] = "1.0.0.0", + ["outputs"] = new Dictionary + { + ["string"] = new + { + type = "string", + value = "myvalue", + } + }, + ["parameters"] = new Dictionary + { + ["string"] = new + { + type = "string", + } + }, + ["resources"] = Array.Empty(), + ["variables"] = new Dictionary + { + ["array"] = new object[] + { +"1", +"2", +"3", +"4" + }, + ["bool"] = "true", + ["int"] = "42", + ["object"] = new Dictionary + { + ["object"] = new + { + location = "West US", + vmSize = "Large", + } + }, + ["string"] = "string" + } + }); + TemplateHashResult result = await tenantResource.CalculateDeploymentTemplateHashAsync(template); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestBase.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestBase.cs new file mode 100644 index 000000000000..07abbafa73f6 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestBase.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.IO; +using System.Reflection; +using System.Threading.Tasks; +using System.Text.Json; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.TestFramework; +using Azure.ResourceManager.Resources.Deployments.Models; +using NUnit.Framework; +using JsonObject = System.Collections.Generic.Dictionary; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class ResourcesTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + + protected ResourcesTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ResourcesTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public void CreateCommonClient() + { + Client = GetArmClient(); + } + + protected static ArmDeploymentProperties CreateDeploymentProperties() + { + ArmDeploymentProperties tmpDeploymentProperties = new ArmDeploymentProperties(ArmDeploymentMode.Incremental); + tmpDeploymentProperties.TemplateLink = new ArmDeploymentTemplateLink(); + tmpDeploymentProperties.TemplateLink.Uri = new Uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json"); + tmpDeploymentProperties.Parameters = BinaryData.FromObjectAsJson(new JsonObject() + { + {"storageAccountType", new JsonObject() + { + {"value", "Standard_GRS" } + } + } + }); + return tmpDeploymentProperties; + } + + protected static ArmDeploymentProperties CreateDeploymentPropertiesAtSub() + { + ArmDeploymentProperties tmpDeploymentProperties = new ArmDeploymentProperties(ArmDeploymentMode.Incremental); + tmpDeploymentProperties.TemplateLink = new ArmDeploymentTemplateLink(); + tmpDeploymentProperties.TemplateLink.Uri = new Uri("https://raw.githubusercontent.com/Azure/azure-docs-json-samples/master/azure-resource-manager/emptyrg.json"); + tmpDeploymentProperties.Parameters = BinaryData.FromObjectAsJson(new JsonObject() + { + {"rgName", new JsonObject() + { + {"value", "testDeployAtSub" } + } + }, + {"rgLocation", new JsonObject() + { + {"value", $"{AzureLocation.CentralUS}" } + } + }, + }); + return tmpDeploymentProperties; + } + + protected static ArmDeploymentProperties CreateDeploymentPropertiesUsingString() + { + ArmDeploymentProperties tmpDeploymentProperties = new ArmDeploymentProperties(ArmDeploymentMode.Incremental); + tmpDeploymentProperties.Template = BinaryData.FromString(File.ReadAllText(Path.Combine( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "Scenario", + "DeploymentTemplates", + $"storage-template.json"))); + tmpDeploymentProperties.Parameters = BinaryData.FromString(File.ReadAllText(Path.Combine( + Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), + "Scenario", + "DeploymentTemplates", + $"storage-parameters.json"))); + return tmpDeploymentProperties; + } + + protected static ArmDeploymentProperties CreateDeploymentPropertiesUsingJsonElement() + { + ArmDeploymentProperties tmpDeploymentProperties = new ArmDeploymentProperties(ArmDeploymentMode.Incremental); + tmpDeploymentProperties.TemplateLink = new ArmDeploymentTemplateLink(); + tmpDeploymentProperties.TemplateLink.Uri = new Uri("https://raw.githubusercontent.com/Azure/azure-quickstart-templates/master/quickstarts/microsoft.storage/storage-account-create/azuredeploy.json"); + var parametersObject = new { storageAccountType = new { value = "Standard_GRS" } }; + //convert this object to JsonElement + var parametersString = JsonSerializer.Serialize(parametersObject); + using var jsonDocument = JsonDocument.Parse(parametersString); + var parameters = jsonDocument.RootElement; + tmpDeploymentProperties.Parameters = BinaryData.FromString(parameters.GetRawText()); + return tmpDeploymentProperties; + } + + protected static ArmDeploymentContent CreateDeploymentData(ArmDeploymentProperties deploymentProperties) => new ArmDeploymentContent(deploymentProperties); + + protected static ArmDeploymentContent CreateDeploymentData(ArmDeploymentProperties deploymentProperties, AzureLocation location) => new ArmDeploymentContent(deploymentProperties) + { + Location = location + }; + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestEnvironment.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestEnvironment.cs new file mode 100644 index 000000000000..6ef94f658ee7 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/ResourcesTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class ResourcesTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentCollectionTests.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentCollectionTests.cs new file mode 100644 index 000000000000..706e611db8ca --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentCollectionTests.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class DeploymentCollectionTests : ResourcesTestBase + { + public DeploymentCollectionTests(bool isAsync) + : base(isAsync) + { + } + + [TestCase] + [RecordedTest] + public async Task CreateOrUpdate() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-1-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-C-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + Assert.AreEqual(deployName, deployment.Data.Name); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, null, deploymentData)); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, null)); + } + + [TestCase] + [RecordedTest] + public async Task CreateOrUpdateWithLocation() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string deployName = Recording.GenerateAssetName("deployEx-C-"); + var deploymentData = CreateDeploymentData(CreateDeploymentPropertiesAtSub(), AzureLocation.JapanEast); + ArmDeploymentResource deployment = (await subscription.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + Assert.AreEqual(deployName, deployment.Data.Name); + Assert.ThrowsAsync(async () => _ = await subscription.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, null, deploymentData)); + Assert.ThrowsAsync(async () => _ = await subscription.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, null)); + } + + [TestCase] + [RecordedTest] + public async Task CreateOrUpdateUsingString() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-1-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployExName = Recording.GenerateAssetName("deployEx-C-"); + var deploymentData = CreateDeploymentData(CreateDeploymentPropertiesUsingString()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployExName, deploymentData)).Value; + Assert.AreEqual(deployExName, deployment.Data.Name); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, null, deploymentData)); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployExName, null)); + } + + [TestCase] + [RecordedTest] + public async Task CreateOrUpdateUsingJsonElement() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-1-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployExName = Recording.GenerateAssetName("deployEx-C-"); + var deploymentData = CreateDeploymentData(CreateDeploymentPropertiesUsingJsonElement()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployExName, deploymentData)).Value; + Assert.AreEqual(deployExName, deployment.Data.Name); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, null, deploymentData)); + Assert.ThrowsAsync(async () => _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployExName, null)); + } + + [TestCase] + [RecordedTest] + public async Task List() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-2-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-L-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + _ = await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData); + int count = 0; + await foreach (var tempDeployment in rg.GetArmDeployments().GetAllAsync()) + { + count++; + } + Assert.AreEqual(count, 1); + } + + [TestCase] + [RecordedTest] + public async Task Get() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-3-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-G-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + ArmDeploymentResource getDeployment = await rg.GetArmDeployments().GetAsync(deployName); + AssertValidDeployment(deployment, getDeployment); + } + + private static void AssertValidDeployment(ArmDeploymentResource model, ArmDeploymentResource getResult) + { + Assert.AreEqual(model.Data.Name, getResult.Data.Name); + Assert.AreEqual(model.Data.Id, getResult.Data.Id); + Assert.AreEqual(model.Data.ResourceType, getResult.Data.ResourceType); + Assert.AreEqual(model.Data.Location, getResult.Data.Location); + if (model.Data.Properties != null || getResult.Data.Properties != null) + { + Assert.NotNull(model.Data.Properties); + Assert.NotNull(getResult.Data.Properties); + Assert.AreEqual(model.Data.Properties.ProvisioningState, getResult.Data.Properties.ProvisioningState); + Assert.AreEqual(model.Data.Properties.CorrelationId, getResult.Data.Properties.CorrelationId); + Assert.AreEqual(model.Data.Properties.Timestamp, getResult.Data.Properties.Timestamp); + Assert.AreEqual(model.Data.Properties.Duration, getResult.Data.Properties.Duration); + Assert.AreEqual(model.Data.Properties.Outputs.ToArray(), getResult.Data.Properties.Outputs.ToArray()); + //Assert.AreEqual(model.Data.Properties.Providers, getResult.Data.Properties.Providers); + //Assert.AreEqual(model.Data.Properties.Dependencies, getResult.Data.Properties.Dependencies); + if (model.Data.Properties.TemplateLink != null || getResult.Data.Properties.TemplateLink != null) + { + Assert.NotNull(model.Data.Properties.TemplateLink); + Assert.NotNull(getResult.Data.Properties.TemplateLink); + Assert.AreEqual(model.Data.Properties.TemplateLink.Uri, getResult.Data.Properties.TemplateLink.Uri); + Assert.AreEqual(model.Data.Properties.TemplateLink.ContentVersion, getResult.Data.Properties.TemplateLink.ContentVersion); + Assert.AreEqual(model.Data.Properties.TemplateLink.QueryString, getResult.Data.Properties.TemplateLink.QueryString); + Assert.AreEqual(model.Data.Properties.TemplateLink.RelativePath, getResult.Data.Properties.TemplateLink.RelativePath); + } + Assert.AreEqual(model.Data.Properties.Parameters.ToArray(), getResult.Data.Properties.Parameters.ToArray()); + if (model.Data.Properties.ParametersLink != null || getResult.Data.Properties.ParametersLink != null) + { + Assert.NotNull(model.Data.Properties.ParametersLink); + Assert.NotNull(getResult.Data.Properties.ParametersLink); + Assert.AreEqual(model.Data.Properties.ParametersLink.Uri, getResult.Data.Properties.ParametersLink.Uri); + Assert.AreEqual(model.Data.Properties.ParametersLink.ContentVersion, getResult.Data.Properties.ParametersLink.ContentVersion); + } + Assert.AreEqual(model.Data.Properties.Mode, getResult.Data.Properties.Mode); + if (model.Data.Properties.DebugSetting != null || getResult.Data.Properties.DebugSetting != null) + { + Assert.NotNull(model.Data.Properties.DebugSetting); + Assert.NotNull(getResult.Data.Properties.DebugSetting); + Assert.AreEqual(model.Data.Properties.DebugSetting.DetailLevel, getResult.Data.Properties.DebugSetting.DetailLevel); + } + if (model.Data.Properties.ErrorDeployment != null || getResult.Data.Properties.ErrorDeployment != null) + { + Assert.NotNull(model.Data.Properties.ErrorDeployment); + Assert.NotNull(getResult.Data.Properties.ErrorDeployment); + Assert.AreEqual(model.Data.Properties.ErrorDeployment.DeploymentName, getResult.Data.Properties.ErrorDeployment.DeploymentName); + Assert.AreEqual(model.Data.Properties.ErrorDeployment.ProvisioningState, getResult.Data.Properties.ErrorDeployment.ProvisioningState); + Assert.AreEqual(model.Data.Properties.ErrorDeployment.DeploymentType, getResult.Data.Properties.ErrorDeployment.DeploymentType); + } + Assert.AreEqual(model.Data.Properties.TemplateHash, getResult.Data.Properties.TemplateHash); + if (model.Data.Properties.OutputResources != null || getResult.Data.Properties.OutputResources != null) + { + Assert.NotNull(model.Data.Properties.OutputResources); + Assert.NotNull(getResult.Data.Properties.OutputResources); + Assert.AreEqual(model.Data.Properties.OutputResources.Count, getResult.Data.Properties.OutputResources.Count); + for (int i = 0; i < model.Data.Properties.OutputResources.Count; ++i) + { + Assert.AreEqual(model.Data.Properties.OutputResources[i].Id, getResult.Data.Properties.OutputResources[i].Id); + } + } + if (model.Data.Properties.ValidatedResources != null || getResult.Data.Properties.ValidatedResources != null) + { + Assert.NotNull(model.Data.Properties.ValidatedResources); + Assert.NotNull(getResult.Data.Properties.ValidatedResources); + Assert.AreEqual(model.Data.Properties.ValidatedResources.Count, getResult.Data.Properties.ValidatedResources.Count); + for (int i = 0; i < model.Data.Properties.ValidatedResources.Count; ++i) + { + Assert.AreEqual(model.Data.Properties.ValidatedResources[i].Id, getResult.Data.Properties.ValidatedResources[i].Id); + } + } + //Assert.AreEqual(model.Data.Properties.Error, getResult.Data.Properties.Error); + } + Assert.AreEqual(model.Data.Tags, getResult.Data.Tags); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationCollectionTests.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationCollectionTests.cs new file mode 100644 index 000000000000..1cd757ff6fb2 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationCollectionTests.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class DeploymentOperationCollectionTests : ResourcesTestBase + { + public DeploymentOperationCollectionTests(bool isAsync) + : base(isAsync) + { + } + + [TestCase] + [RecordedTest] + public async Task List() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-1-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + int count = 0; + await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperationsAsync()) + { + count++; + } + Assert.AreEqual(count, 2); //One deployment contains two operations: Create and EvaluteDeploymentOutput + } + + [TestCase] + [RecordedTest] + public async Task Get() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-2-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + ArmDeploymentResource deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + await foreach (var tempDeploymentOperation in deployment.GetDeploymentOperationsAsync()) + { + var getDeploymentOperation = await deployment.GetDeploymentOperationAsync(tempDeploymentOperation.OperationId); + AssertValidDeploymentOperation(tempDeploymentOperation, getDeploymentOperation); + } + } + + private static void AssertValidDeploymentOperation(ArmDeploymentOperation model, ArmDeploymentOperation getResult) + { + Assert.AreEqual(model.Id, getResult.Id); + Assert.AreEqual(model.OperationId, getResult.OperationId); + if (model.Properties != null || getResult.Properties != null) + { + Assert.NotNull(model.Properties); + Assert.NotNull(getResult.Properties); + Assert.AreEqual(model.Properties.ProvisioningState, getResult.Properties.ProvisioningState); + Assert.AreEqual(model.Properties.ProvisioningOperation, getResult.Properties.ProvisioningOperation); + Assert.AreEqual(model.Properties.Timestamp, getResult.Properties.Timestamp); + Assert.AreEqual(model.Properties.Duration, getResult.Properties.Duration); + //Assert.AreEqual(model.Properties.ServiceRequestId, getResult.Properties.ServiceRequestId); // The list item from ArmDeploymentResource.GetDeploymentOperations() no longer has values for ServiceRequestId since version 2022-09-01. + Assert.AreEqual(model.Properties.StatusCode, getResult.Properties.StatusCode); + //Assert.AreEqual(model.Data.Properties.StatusMessage, getResult.Data.Properties.StatusMessage); + if (model.Properties.TargetResource != null || getResult.Properties.TargetResource != null) + { + Assert.NotNull(model.Properties.TargetResource); + Assert.NotNull(getResult.Properties.TargetResource); + Assert.AreEqual(model.Properties.TargetResource.Id, getResult.Properties.TargetResource.Id); + Assert.AreEqual(model.Properties.TargetResource.ResourceName, getResult.Properties.TargetResource.ResourceName); + Assert.AreEqual(model.Properties.TargetResource.ResourceType, getResult.Properties.TargetResource.ResourceType); + } + if (model.Properties.Request != null || getResult.Properties.Request != null) + { + Assert.NotNull(model.Properties.Request); + Assert.NotNull(getResult.Properties.Request); + Assert.AreEqual(model.Properties.Request.Content, getResult.Properties.Request.Content); + } + if (model.Properties.Response != null || getResult.Properties.Response != null) + { + Assert.NotNull(model.Properties.Response); + Assert.NotNull(getResult.Properties.Response); + Assert.AreEqual(model.Properties.Response.Content, getResult.Properties.Response.Content); + } + } + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationsTests.cs b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationsTests.cs new file mode 100644 index 000000000000..4f6d7a35eb29 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentOperationsTests.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources.Deployments.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Resources.Deployments.Tests +{ + public class DeploymentOperationsTests : ResourcesTestBase + { + public DeploymentOperationsTests(bool isAsync) + : base(isAsync) + { + } + + [TestCase] + [RecordedTest] + public async Task Delete() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-4-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + string deployName = Recording.GenerateAssetName("deployEx-D-"); + var deploymentData = CreateDeploymentData(CreateDeploymentProperties()); + var deployment = (await rg.GetArmDeployments().CreateOrUpdateAsync(WaitUntil.Completed, deployName, deploymentData)).Value; + await deployment.DeleteAsync(WaitUntil.Completed); + var ex = Assert.ThrowsAsync(async () => await deployment.GetAsync()); + Assert.AreEqual(404, ex.Status); + } + + [TestCase] + [RecordedTest] + public async Task WhatIfAtResourceGroup() + { + SubscriptionResource subscription = await Client.GetDefaultSubscriptionAsync(); + string rgName = Recording.GenerateAssetName("testRg-5-"); + ResourceGroupData rgData = new ResourceGroupData(AzureLocation.WestUS2); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, rgData); + ResourceGroupResource rg = lro.Value; + ResourceIdentifier deploymentResourceIdentifier = ArmDeploymentResource.CreateResourceIdentifier(rg.Id, "testDeploymentWhatIf"); + ArmDeploymentResource deployment = Client.GetArmDeploymentResource(deploymentResourceIdentifier); + var deploymentWhatIf = new ArmDeploymentWhatIfContent(new ArmDeploymentWhatIfProperties(ArmDeploymentMode.Incremental) + { + Template = CreateDeploymentPropertiesUsingString().Template, + Parameters = CreateDeploymentPropertiesUsingJsonElement().Parameters + }); + WhatIfOperationResult whatIfOperationResult = (await deployment.WhatIfAsync(WaitUntil.Completed, deploymentWhatIf)).Value; + Assert.AreEqual(whatIfOperationResult.Status, "Succeeded"); + Assert.AreEqual(whatIfOperationResult.Changes.Count, 1); + Assert.AreEqual(whatIfOperationResult.Changes[0].ChangeType, WhatIfChangeType.Create); + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/mg-stack-template.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/mg-stack-template.json new file mode 100644 index 000000000000..9103dd59aa00 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/mg-stack-template.json @@ -0,0 +1,16 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-08-01/managementGroupDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "message": { + "type": "string" + } + }, + "resources": [], + "outputs": { + "outputMessage": { + "type": "string", + "value": "[parameters('message')]" + } + } +} \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/rg-stack-template.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/rg-stack-template.json new file mode 100644 index 000000000000..e63064520aa1 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/rg-stack-template.json @@ -0,0 +1,24 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "templateSpecName": { + "type": "string" + } + }, + "variables": { + "location": "[resourceGroup().location]" + }, + "resources": [ + { + "type": "Microsoft.Resources/templateSpecs", + "apiVersion": "2022-02-01", + "name": "[parameters('templateSpecName')]", + "location": "[variables('location')]", + "properties": { + "displayName": "[parameters('templateSpecName')]", + "description": "Template Spec for RG scoped Deployment Stack Test" + } + } + ] +} \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/simple-storage-account.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/simple-storage-account.json new file mode 100644 index 000000000000..f9d4397166cc --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/simple-storage-account.json @@ -0,0 +1,22 @@ +{ + "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "storageAccountName": { + "type": "string" + } + }, + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "name": "[parameters('storageAccountName')]", + "apiVersion": "2015-06-15", + "location": "[resourceGroup().location]", + "properties": { + "accountType": "Standard_LRS", + "supportsHttpsTrafficOnly": "true" + } + } + ], + "outputs": {} +} \ No newline at end of file diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-parameters.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-parameters.json new file mode 100644 index 000000000000..e560c0c5142b --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-parameters.json @@ -0,0 +1,5 @@ +{ + "storageAccountType": { + "value": "Standard_GRS" + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-template.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-template.json new file mode 100644 index 000000000000..29eb2297a960 --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/storage-template.json @@ -0,0 +1,68 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "metadata": { + "_generator": { + "name": "bicep", + "version": "0.4.1008.15138", + "templateHash": "104821603399126558" + } + }, + "parameters": { + "storageAccountType": { + "type": "string", + "defaultValue": "Standard_LRS", + "allowedValues": [ + "Premium_LRS", + "Premium_ZRS", + "Standard_GRS", + "Standard_GZRS", + "Standard_LRS", + "Standard_RAGRS", + "Standard_RAGZRS", + "Standard_ZRS" + ], + "metadata": { + "description": "Storage Account type" + } + }, + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for all resources." + } + }, + "storageAccountName": { + "type": "string", + "defaultValue": "[format('store{0}', uniqueString(resourceGroup().id))]", + "metadata": { + "description": "The name of the Storage Account" + } + } + }, + "functions": [], + "resources": [ + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2021-04-01", + "name": "[parameters('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "[parameters('storageAccountType')]" + }, + "kind": "StorageV2", + "properties": {} + } + ], + "outputs": { + "storageAccountName": { + "type": "string", + "value": "[parameters('storageAccountName')]" + }, + "storageAccountId": { + "type": "string", + "value": "[resourceId('Microsoft.Storage/storageAccounts', parameters('storageAccountName'))]" + } + } +} diff --git a/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/sub-stack-template.json b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/sub-stack-template.json new file mode 100644 index 000000000000..41eea5f5e12c --- /dev/null +++ b/sdk/resources/Azure.ResourceManager.Resources.Deployments/tests/Scenario/DeploymentTemplates/sub-stack-template.json @@ -0,0 +1,22 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "rgname": { + "type": "string", + "defaultValue": "testStacksSDK321" + }, + "location": { + "type": "string", + "defaultValue": "[deployment().location]" + } + }, + "resources": [ + { + "type": "Microsoft.Resources/resourceGroups", + "apiVersion": "2021-04-01", + "name": "[parameters('rgname')]", + "location": "[parameters('location')]" + } + ] +} \ No newline at end of file diff --git a/sdk/resources/ci.mgmt.yml b/sdk/resources/ci.mgmt.yml index 3fefd5254c85..bcacfa8499f1 100644 --- a/sdk/resources/ci.mgmt.yml +++ b/sdk/resources/ci.mgmt.yml @@ -12,6 +12,7 @@ pr: include: - sdk/resources/ci.mgmt.yml - sdk/resources/Azure.ResourceManager.Resources/ + - sdk/resources/Azure.ResourceManager.Resources.Deployments/ extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml @@ -21,3 +22,5 @@ extends: Artifacts: - name: Azure.ResourceManager.Resources safeName: AzureResourceManagerResources + - name: Azure.ResourceManager.Resources.Deployments + safeName: AzureResourceManagerResourcesDeployments \ No newline at end of file